Open reaua001 opened 1 year ago
Let me clarify one thing
Your function ajax example does fire the if (data.action === 'load') But this example data is loaded via raw HTML and not an Ajax call via
var dTable = $(".datatable").DataTable({
"dom": "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
"responsive": true,
"serverSide": true,
"processing": true,
"ajax": {
"url": "/Home/Data/Get",
"type": "POST"
}, ...
If you do above, the data.action === 'load' will never call
I confirm the problem with update (save) and AJAX. To complete with @reaua001's "fix" at loading all states are saved after loading, this is not a good thing.
I confirm the problem with update (save) and AJAX. To complete with @reaua001's "fix" at loading all states are saved after loading, this is not a good thing. I could never get this extension to work properly
Sir, I went ahead and removed StateRestore and did my own version which uses the native state load/save and use my own dropdown box to load the states. The only issue is it requires a browser refresh to load as it can only be done at datatable init.
I could never get this extension to work properly
Apologies for the long delay on this one. Thanks for flagging it up - I'll take a look into it!
Have been having issues trying to get StateRestore to load all states via server side Ajax call
using the function style ajax calls per See Here to control all the server side saving
I have never seen if (data.action === 'load') option ever fire... so I resorted to using the ajax stateRestore option on initial load as See Here
Everything works until browser refresh and then you can't update any of the existing based on this area in StateRestore.ts (line 751-758)
what occurs is all the states are set to isPreDefined: true even for ajax loading
There is also a typo in StateRestoreCollection.ts where you in line 641-647
It s/b isPreDefined not isPredefined
I looked at your source code and I don't ever see a callback for the load process, and all the function Ajax examples don't ever load server side.
Your above initialisation/ajax.html example fails the same way
Steps: 1: Load a new state and try all the options (Rename, Update, Remove) they all fire a callback to server 2: Keep at least one state and re-fresh browser. 3: You can do all options except Update (check and all the loaded states are now IsPreDefined)
In my case, I never have preDefined: in the DataTable settings... so I turned off the true condition in StateResotrCollection.ts _addPreDefined (line 878)
So in closing, A) is there a way to load via function call Ajax from the server or B) you should change the _addPreDefined call to add a boolean to set that isPreDefined to false for Ajax loads
Thanks