bStateSave not working when sServerMethod is set to "POST"

bStateSave not working when sServerMethod is set to "POST"

JohnTimmsJohnTimms Posts: 2Questions: 0Answers: 0
edited June 2012 in General
bStateSave has been working great, but I just made some changes and now it doesn't work any more. Here are the changes I've made:

I set "sServerMethod" to "POST"
I added about 30 columns (I'm not using aoColumns or aoColumnDefs)
I changed the data source from "/admin/users.json" to "/admin/users/display_table.json"

Now, everything else works, there are no warnings or errors and my massive table displays correctly. However, the searches I type, the columns I have displayed (with the "ColVis" extra) and the page I'm on are not being saved at all between page refreshes.

Replies

  • JohnTimmsJohnTimms Posts: 2Questions: 0Answers: 0
    I've been doing some more research, and I believe that I've mis-identified the problem. The issue is not sServerMethod, but actually since I have so many columns (about 37) the cookie size is getting too large. I don't have proof of this yet, but I'm reading this thread: (http://datatables.net/forums/discussion/576/cookie-limit-long-cookie-fails/p1) and am finding some good information.

    Might I make the suggestion that when the cookie DOES get too large, that DataTables do something and not just fail silently? Perhaps issue an alert or something?
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    The cookie one is a tricky issue - I'd very much encourage you to consider using localStorage where you won't have that issue: http://datatables.net/blog/localStorage_for_state_saving .

    The reason DataTables doesn't emit an 'alert' here, is because it is reasonably likely not to happen in a development environment, but it does for end users - hence the silent dropping of the cookie. I do plan to make a "trace" version of DataTables at some point that would include a large amount of logging, including this kind of thing.

    Allan
This discussion has been closed.