Which Events Fire First.

Which Events Fire First.

kinetikkinetik Posts: 10Questions: 4Answers: 0
edited November 2018 in Free community support

I'm attempting to write a plugin for managing server side saved views.

I initialize this plugin.

with the following code.

$(document).on( 'preInit.dt.viewManager', function (e, settings) {
if ( e.namespace !== 'dt' ) {
return;
}

var init = settings.oInit.viewManager;
var defaults = DataTable.defaults.viewManager;

if ( init || defaults ) {
    var config = $.extend( {}, init, defaults );

    if ( init !== false ) {
        new viewManager( settings, config  );
    }
}

} );

Then during construction I add an event listener for stateLoadparams

    // If during configuration we've been passed a new view to load lets set that in the dataTables State. 
    dt.on( 'stateLoadParams.dt.viewManager', function (event, settings, data) {
                console.log(that.s);
        if(!that.c.viewToLoad.isEmptyObject({})){
            data = that.c.viewToLoad;
            that.s.filters.currentFilter = that.c.viewToLoad.viewManager.currentFilter;
            console.log(that.s);
        }
    } );

But it appears this event never gets fired.

either that or it gets fired before preInit? is there anywhere that i can find an order of these event call backs?

Answers

This discussion has been closed.