Adding row numbers to tables

Home Forum Working with Tables Adding row numbers to tables

This topic contains 1 reply, has 0 voices, and was last updated by  Anonymous 8 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #462

    Anonymous

    I’d like the first column of my table to show the row number. This field should auto update when I add/delete a row. So first column of row 1 should Say “1”, row 2 should say “2”, etc. How do I do this short of manually requiring the user to type in the row number himself?

    #5197

    ijobling
    Participant

    You can add row numbers using a hidden numeric field. Whenever you add a new row just get the value from this hidden field and use the setTableRows object command to set the first column value of the new row, Just increment the numeric value by 1 once you have set it and so the next new row will have the incremented value. You can have this logic in Row is added behavior. You can also decrement the number when you delete a row.

    The only problem with this is that if you happen to delete a row in between rows and if you want to re-use that number. It is possible to do that, you need to implement additional logic to do this.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.