Documentation parameters "fnStateLoadCallback" and "fnStateSaveCallback" in 1.7.4
Documentation parameters "fnStateLoadCallback" and "fnStateSaveCallback" in 1.7.4
cyberlussi
Posts: 6Questions: 0Answers: 0
Hallo,
I am very interested in this 1.7.4 release note item - but I could not find the documentation yet ... when will it be available?
New: Addtinoal ability to control state saving through two new initialisation parameters "fnStateLoadCallback" and "fnStateSaveCallback". Documentation to be updated on datatables.net at 1.7.4 release time. Basically now you can add parameters to be save, and override parameters whic have been saved. Also useful for plug-ins which need to save state.
I am very interested in this 1.7.4 release note item - but I could not find the documentation yet ... when will it be available?
New: Addtinoal ability to control state saving through two new initialisation parameters "fnStateLoadCallback" and "fnStateSaveCallback". Documentation to be updated on datatables.net at 1.7.4 release time. Basically now you can add parameters to be save, and override parameters whic have been saved. Also useful for plug-ins which need to save state.
This discussion has been closed.
Replies
You are indeed quite right - I've yet to put the documentation for those two callbacks up. It spilled my mind just after the release - thanks for the reminder! I'll do it within the next 12 hours :-)
Regards,
Allan
Allan
fnStateLoadCallback is still called fnStateLoadParams in the online docs.
this is the same thing but it is to be noted that if you do not return a true value e.g return true
this callback will in full ignore your StateLoad oData due to this in the original code:
[code]
if ( !oSettings.aoStateLoad[i].fn( oSettings, oData ) )
{
return;
}
[/code]
this make changes to anything oData you want (e.g oData.sFilter) and then return true indicating the information can be used for state loading to the above validation check
so an example would be:
[code]
$('.tablesorter').dataTable( {
"bStateSave": true,
"fnStateLoadCallback": function (oSettings, oData) {
oData.sFilter = "Some other value instead of the cookie loaded value";
return true;
}
});
[/code]
They have been removed from DataTables 1.9. Please see this blog post: http://datatables.net/blog/localStorage_for_state_saving
Allan