Getting next index on sorted table

Getting next index on sorted table

bodylossbodyloss Posts: 1Questions: 0Answers: 0
edited October 2010 in General
Hey all

Any ideas how i can get the next row index given the one that is meant to be before it in a sorted table?

I've searched the forums an checked the api an examples, and cant seem to find what im looking for.

I'm trying to get the next index in my data table, given the index before. The only problem is that all columns are sortable and therefore I cant seem to get the next index, rather it gives me the next index (oldIndex + 1) in the unsorted table.

I've tried using what was shown in the" DataTables row numbers example" but as i'm using scrolling but also need to have the table headers, all this seems to do is mess up my columns and show 2 headers.

Regards and thanks for any help
Joey

Replies

  • ajoslin103ajoslin103 Posts: 20Questions: 4Answers: 0
    loop aiMasterDisplay to index into aoData to get the items back in sorted order
    (looping with aiDisplay will return the filtered sorted set)
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    There is a plug-in for setting the adjacent TR ( http://datatables.net/plug-ins/api#fnGetAdjacentTr ), which you are use or modify. You could use the plug-in as is to get the next TR and then look up it's index for example, or modify it to just return the index.

    Allan
This discussion has been closed.