Question on Update and Paging
Question on Update and Paging
Hi,
I have a table with over150,000 records. I am trying to display the records in datatables.
Issue 1:
The table is taking long time to load. Is there someway to get the records corresponding to the page number the user is in? For example if the user is in page 2 - display the records where id between 11 and 20 instead of loading the entire table everytime.
Issue 2:
When i update a value, the value is returning back to its original value after clicking on update. I have written table.reload function to be called after every update. Since the table is huge it is taking long time to reload. I want some way for the update to show in the UI immediately without refreshing the entire table every time.
Please find attached the code.
Thanks for your help!
Answers
Use server-side processing.
Are you saying on click of a page number, pass that as parameter to db and get the corresponding rows?
Currently the editor gets all the data and assigns the total number of pages internally(if i have 35 records it shows page numbers 1 to 4). How do i calculate this and set that value for number of pages when I do server side processing?
I can take count of total records and divide by 10 to get the number of pages but how do i pass that value to the paging so that it not only displays the first 10 records but also shows the other page numbers for the user to click?
Not sure if I explained my problem clearly. Please let me know if you need further information.
Did you look at the server-side processing example?
https://editor.datatables.net/examples/simple/server-side-processing.html