Jump to page based on search (with bServerSide)
Jump to page based on search (with bServerSide)
fbas
Posts: 1,094Questions: 4Answers: 0
Here's a little twist on searching that I'd like to implement. (with bServerSide)
Client wants to be able to jump to page based on some criteria. To keep it simple, perhaps I'd only allow the jump based on row id.
Would like to send all the same search criteria to back-end (the jump-to search would not replace or interfere with the global filter but instead should complement it) but rather than return a paginated selection, calculate which page it would be on and return that number.
Is there an easy way to gather all the same info that would be passed as aoData when a draw/filter is called on server-side scripts?
[my specific case involves using sColumns and array-based, sName (not mDataProp) based inputs, but a general solution to fit all cases would be best]
Client wants to be able to jump to page based on some criteria. To keep it simple, perhaps I'd only allow the jump based on row id.
Would like to send all the same search criteria to back-end (the jump-to search would not replace or interfere with the global filter but instead should complement it) but rather than return a paginated selection, calculate which page it would be on and return that number.
Is there an easy way to gather all the same info that would be passed as aoData when a draw/filter is called on server-side scripts?
[my specific case involves using sColumns and array-based, sName (not mDataProp) based inputs, but a general solution to fit all cases would be best]
This discussion has been closed.
Replies
1) set a jump-to value
2) in fnServerData detect jump-to value and add a parameter to aoData, clear the client-side jump-to value
3) if json returns with jump-to page specified, go to that page, else process with fnCallback
So two possibilities spring to mind:
1. You could implement caching of the JSON response (a bit like the server-side cache example) to reduce the XHRs required for each draw to just 1 (i.e. always return the data set you want to draw, but you your flag as well - then if the flag is set on the redraw, no request will be required - just give it the data from before).
2. Similar to 1, but slightly backwards, when you see your flag, have the table redraw, but use the data from the response to draw the table (actually, this could be the same as 1, just depending on how it is implemented!).
Regards,
Allan