Which Events Fire First.
Which Events Fire First.
kinetik
Posts: 10Questions: 4Answers: 0
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?
This discussion has been closed.
Answers
have you a test case that i can make any test and look into the code. there is a good practice bring a live example for this. ... waiting for your response.
https://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read#latest
I can present a test case but will need to strip out server side methods. Was hoping it would be a quick answer but will gladly provide a test case. Will post one soon
The effort is worth