Documentation parameters "fnStateLoadCallback" and "fnStateSaveCallback" in 1.7.4

Documentation parameters "fnStateLoadCallback" and "fnStateSaveCallback" in 1.7.4

cyberlussicyberlussi Posts: 6Questions: 0Answers: 0
edited November 2010 in General
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.

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Hi cyberlussi,

    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
  • cyberlussicyberlussi Posts: 6Questions: 0Answers: 0
    Wonderful!
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    They are up now: http://datatables.net/usage/callbacks#fnStateLoadCallback :-)

    Allan
  • di4bl0sdi4bl0s Posts: 17Questions: 0Answers: 0
    edited February 2012
    for those trying to find more info on this, I found the documentation is missing?
    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]
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    > for those trying to find more info on this, I found the documentation is missing?

    They have been removed from DataTables 1.9. Please see this blog post: http://datatables.net/blog/localStorage_for_state_saving

    Allan
This discussion has been closed.