Defer state loading until plugin initialization has finished?

Defer state loading until plugin initialization has finished?

charles_dyfis_netcharles_dyfis_net Posts: 4Questions: 0Answers: 0
edited March 2012 in General
Howdy --

I'm trying to write some function helpers (hooking in via fnStateLoadParams and fnStateSaveParams) to save the state of the text fields created by the ColumnFilter plugin.

Saving works fine. On load, however, fnStateLoadParams is being invoked before the columnFilter plugin has had a chance to create its fields, so I'm unable to find these to populate them.

Any suggested solutions? A way to defer the attempt to load state until after plugin initialization finishes would seem to be ideal.

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Use the oSettings.oLoadedState object - this is the loaded state object, so you can use it at the end of the initialisation: http://datatables.net/docs/DataTables/1.9.0/DataTable.models.oSettings.html#oLoadedState

    Its a bit of a quirk with the stateloadParams event / callback atm that the plug-in can't see that trigger - I'm not 100% sure what the best way of solving that is at the moment, but with oLoadedState there is a "work-around" available :-)

    Allan
This discussion has been closed.