Get page number from id
Get page number from id
Hi all.
I'm using server-side processing.(DataTables 1.10.11)
I need to jump to page that contain specific <tr id=""> (or ROWID), after ajax.reload();
I'm able to change page with table.page(5).draw('page'),
but i'm unbale to find the number of page that contain specific <tr> id value.
In other words:
I insert new record in table .
Insert retrurn new record ID.
I do a ajax.reload() that reload all row and put in each tr the row id (Example:<tr id='35'>)
After this i'm on the first page.
But now i want to jump to the page that contain the new row, starting from know new id.
So i need to get page number, in wich is located new <tr id='newid' >
How should i do it?
Many many thanks.
This question has an accepted answers - jump to answer
Answers
I would take a slightly different approach. You don't need to do a reload because you are doing server side processing. My approach would be to send page size along with what is ever needed when you do the save new row. Have the ajax return the calculated page number from the save. Use the datatable page object to jump to that page.
Ok i understand,many thanks.
I'll try.
It works. Many thanks friend.