State loading and saving for plug-ins
State loading and saving for plug-ins
Hi,
I'm writing a plug-in to handle row selection for server-side DataTables (effectively a wrapper around Iuliandum's technique at http://datatables.net/examples/server_side/select_rows.html) , but I'm having some difficulty understanding the plug-in API for loading state. I've got as far as knowing that I have to subscribe to the stateLoadParams event (http://datatables.net/docs/DataTables/1.9.beta.2/DataTable.html#stateLoadParams) but I'm not actually sure how to do this!
If anyone has any examples of loading state in a plug-in initialiser I would be most grateful.
Thanks
Ben
I'm writing a plug-in to handle row selection for server-side DataTables (effectively a wrapper around Iuliandum's technique at http://datatables.net/examples/server_side/select_rows.html) , but I'm having some difficulty understanding the plug-in API for loading state. I've got as far as knowing that I have to subscribe to the stateLoadParams event (http://datatables.net/docs/DataTables/1.9.beta.2/DataTable.html#stateLoadParams) but I'm not actually sure how to do this!
If anyone has any examples of loading state in a plug-in initialiser I would be most grateful.
Thanks
Ben
This discussion has been closed.
Replies
[code]
var dataTable = oDTSettings.oInstance;
dataTable.bind('stateLoadParams', function() {
// do something here
});
[/code]
After double-checking my binding it became evident that the problem is that stateLoadParams is fired before the plug-in is initialised (so it never gets fired). Any workarounds/fixes?
Allan
oLoadedState worked perfectly. Many thanks for such an excellent control!
Ben
Allan