How to save the state of server-side queries
How to save the state of server-side queries
It's quite possible that I'm misunderstanding the purpose of the bStateSave option, so please bear with me.
Basically, I have a web page with a search form and an empty HTML table. If the user performs a search, I'm making an Ajax call to the web server, processing the results and populating the HTML table. For the time being, I've disabled both sorting and filtering of the table. Sorting will be enabled at a later date and filtering is done via the search form. Paging, however, is enabled. As part of the rendering of data received from the server, I'm creating a "View details" link in one of the columns. So the HTML table shows a high-level view of the data, but users can click the "View Details" link of any row to visit the Details page (i.e., the URL is something along the lines of "/Details?=101", etc.)
The problem I have is that once users click a link to go to the Details page and then use their browser's Back button, the HTML table on the Search page is empty again. In other words, they have to re-enter their search query (and possibly navigate to the appropriate page of results).
Is this something that '"bStateSave": true' should resolve? Because it doesn't seem to be working although perhaps I've got some code elsewhere that's overriding the saved state. Any constructive suggestions would be greatly appreciated. Thanks!
Basically, I have a web page with a search form and an empty HTML table. If the user performs a search, I'm making an Ajax call to the web server, processing the results and populating the HTML table. For the time being, I've disabled both sorting and filtering of the table. Sorting will be enabled at a later date and filtering is done via the search form. Paging, however, is enabled. As part of the rendering of data received from the server, I'm creating a "View details" link in one of the columns. So the HTML table shows a high-level view of the data, but users can click the "View Details" link of any row to visit the Details page (i.e., the URL is something along the lines of "/Details?=101", etc.)
The problem I have is that once users click a link to go to the Details page and then use their browser's Back button, the HTML table on the Search page is empty again. In other words, they have to re-enter their search query (and possibly navigate to the appropriate page of results).
Is this something that '"bStateSave": true' should resolve? Because it doesn't seem to be working although perhaps I've got some code elsewhere that's overriding the saved state. Any constructive suggestions would be greatly appreciated. Thanks!
This discussion has been closed.
Replies
I think there might have been a bug in DataTables which you are encountering at the moment. Could you try your test with the 1.8 beta release please and see if that addresses it (certainly in the commit notes there is a bug related to this that I fixed).
Regards,
Allan
[code] {
"fnRender": function (oObj) {
return '' + oObj.aData[0] + '';
},
"aTargets": [0], "bSearchable": false
},[/code]
...seems to produce the following HTML...
[code]1000548[/code]
Once I've had a chance to tweak the code and test the state saving code, I'll update this thread.
Thanks!
- g
Allan
Regards,
Allan
As for the state of the grid, that seems to be lost when users hit the back button. I need to review my code to see if there's something that's causing the table to "reset" back to its original, blank state. I'll try to remember to post back here one way or the other in case it's helpful for others, too.
Thanks again for your help!
- g
Allan