Callback after table is drawn?
Callback after table is drawn?
Is there a callback that I can call after the table is drawn and completely done?
I'm using an ajax data source.
In my columns declaration, I'm using the "render" option to render
<
div> tags with specific classes.
I then have event listeners that attach to those classes so that I can do additional stuff (like open a modal, expand children, etc).
when I set my 'initComplete' option function to look for all of my specific classes, it can't find any because they aren't drawn yet.
I'm just looking for a "everything's done" event. Anyone?
Answers
Maybe
https://datatables.net/reference/event/draw
thanks for the reply. Draw actually fires before the initComplete event.
my bad..it does actually fire after initComplete, but still not before I can attach anything to a dom element.
initComplete
executes once the Datatable has completed initialization. If the classes aren't there then maybe the column render is not right. Are you attaching the listeners form within initComplete? You may need to move them there.Maybe you can post a test case using one of the AJAX loaded JS BIN templates:
https://datatables.net/manual/tech-notes/9#Ajax-loaded-data
Kevin
Thanks Kevin - yes, I'm calling the listener functions from within the initComplete option.
When I open up the console after the page is rendered I can call the listener functions and they attach fine.
that's why I was thinking initComplete wasn't firing as late as I wanted.
I'll see if I can work up an example.