server side datatable with saveState error if current data is less than previously save page number
server side datatable with saveState error if current data is less than previously save page number
alamadcs
Posts: 4Questions: 1Answers: 0
I have a php server side script to generate data for datatable
my data table has saveSate=true
for every thing means if I an going to page 5 it will save page 5 for that page.
next time when I am coming to this page it will try to get data with offset 50 considering pagelength=10
so it is generating error at PHP side. when applying offset 50 on less than 50 records
how can we handle this situation
Answers
I don't quite understand. Are you saying that the number of records is changing between loads? i.e. it used to have more than 50, but now is less? Or that it isn't saving the page length?
Allan
I have listing page containing 51 records of pending requests.
If and am coming at page 6 there will be one record, and saveState will save my current page as page#6
not I opened that one record at 6th page, and approved it, that record is no more pending so it will not come again in pending requests. after approving it will be redirected to listing page and this time total records are 50 instead of 51 and page#6 was saved as per previous saveState but with 50 records there is no 6th page.
so it should show 5 page (or 1st page. I am not sure about all scenarios may be in some cases there will be 1 or zero records)
?
What is the error?
Are you using a Datatables supplied server side processing script?
I would look at adding code to the server script to handle the error condition. You can then decide whether to return the 5th page or the 1st page based on your requirements.
Kevin
its simple, client side requesting 6th page of 10 records, but server has only 20 records
Line 68 has error
The problem is explained from line 70 to 86