fnGetPosition to real position

fnGetPosition to real position

fbolandfboland Posts: 18Questions: 0Answers: 0
edited December 2013 in General
I use datatable in server side processing.

I know i can get the position with fnGetPosition function.

But this function return the position of the row without counting the records that are not in memory.

For example, first ajax request return 100 records.
I scroll to the 150th record, a second ajax request is done.
the function fnGetPosition(150th row) return 50.
I search a solution to convert 50 to 150.

someone has an idea ?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    This is absolutely correct and how server-side processing works. The position reported by fnGetPosition is of no use to anything but DataTables! It is effectively an internal index and should not be used for anything else.

    What I would suggest, is if you want a reference to a specific row, ensure that the table's primary key value is available in the data and use fnGetData to get the primary key value, so you have a reference to the row properly, regardless of filtering, sorting etc.

    Allan
This discussion has been closed.