Equivalent of xhr event for *after* the ajax data has loaded
Equivalent of xhr event for *after* the ajax data has loaded
creidieki
Posts: 7Questions: 3Answers: 0
The documentation of the xhr event https://datatables.net/reference/event/xhr says that it's called "before DataTables has processed the new data from the server, so the returned data will not have been drawn on page when this event fires." What's the equivalent for triggering something afterwards?
(Documentation question, so no test case, just link to documentation.)
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I would say the
draw
event. But thedraw
event will happen at other times. I don't think there is a specific event that follows thexhr
event. See this example for some of the events to see their order when the Datatable is initialized.http://live.datatables.net/qosupeti/5/edit
What are you looking to do after the
xhr
event?Kevin
Heh, yeah, I had settled on the draw event. I started typing a detailed explanation of my problem, and in the process figured out how to fix it in a cleaner way. Thanks again for your help!
(In case you're interested, I had a button in each row of the table, and I was using the table init event to attach handlers to them. I needed to figure out how to reattach handlers after a table.ajax.reload(), using the function argument to that.)
Another option is to use delegated events as shown in this example. Then you won't need to worry about adding event handlers. Here is a running example with buttons:
http://live.datatables.net/xijecupo/1/edit
Kevin