State Saving does not work
State Saving does not work
visionx
Posts: 22Questions: 4Answers: 5
I have a problem when I make a data table for state saving. I have configured "bStateSave=true" in data table and state has not been saved when I reload the page. I tried to save state in database using following way also but it did not work.
"fnStateSave": function (oSettings, oData) {
alert('state saved...');
// Send an Ajax request to the server with the state object
$.ajax( {
"url": '/testUrl/test.ajax?command=stateSave',
"data": oData,
"dataType": "json",
"method": "POST",
"success": function () {}
} );
},
When this "fnStateSave" function is called? Is that happens each and every state change in data table such as sorting, pagination etc.?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Can you show me your state load function please? The state saving looks okay and I presume is working?
Allan
This is the state load function.
Even I am not seeing java script alert for the table state changes like sorting, paging etc. When this "fnStateSave" function is called...shouldnt it be called upon the each and every state change?
Thanks in advance !!!
It should be, yes. Basically every draw will trigger a state change.
Are you using 1.10? If so, use
stateSaveCallback
andstateLoadCallback
rather than the old style parameter names. That might be the issue here.Allan
Thanks a lot allan !!! I am using 1.10.4 version and when I use stateSaveCallback and stateLoadCallback functions it works as expected.