javascript - Jquery Datatable Save state in DB not in client side -
i need save state of datatable in db.i want have save state button when pressed should in on click event of save state button ? functions have override send ajax request server containing state of datatable? want load saved state db.
use statesavecallback
callback
"statesavecallback": function (settings, data) { // send ajax request server state object $.ajax( { "url": "/state_save", "data": data, "datatype": "json", "type": "post", "success": function () {} } );
for more info:https://datatables.net/reference/option/statesavecallback
for loading use stateloadcallback
callback
"stateloadcallback": function (settings) { var o; $.ajax( { "url": "/state_load", "async": false, "datatype": "json", "success": function (json) { o = json; } } ); return o; }
more info: https://datatables.net/reference/option/stateloadcallback
Comments
Post a Comment