Row Number

Row Number

Tal17Tal17 Posts: 6Questions: 0Answers: 0
edited April 2009 in General
I apologize if this a dumb question, but what is the right way to get datatables to number each row and not have those numbers messup when you sort.

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Hi Tal17,

    Do you mean that you want numbers down the left hand side (for example) of the table? This could be achieved by making use of fnDrawCallback() ( http://datatables.net/usage#fnDrawCallback ). This function is called every time the table is redrawn, so you could parse through the DOM at that point and update the displayed node numbering. If you want this column to be itself sortable, then you'll need to make use of fnUpdate(), otherwise direct DOM manipulation should do the trick.

    Hope this helps,
    Allan
This discussion has been closed.