How to handle `initComplete`?
How to handle `initComplete`?
What is the proper way to attach an event handler to Editor's initComplete
?
This is what I tried:
var editor = new $.fn.dataTable.Editor(editorOptions);
editor.on('initComplete', function(e) { alert('init complete') });
My callback is never executed. I suspect that the event is triggered before I get a chance to attach a handler.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You are exactly correct - the initialisation of Editor is synchronous so there is no need for that event handler. Just execute your code immediately after the
new ...Editor()
call.That event is actually redundant now. Way back in Editor 1.0-1.3 you could add events using the initialisation objects to make them like callbacks. You actually still can do that, but it isn't documented since the events are much nicer to work with and that functionality will eventually be removed.
Thanks for pointing out that this event is redundant - I'll mark it as deprecated.
Allan