Reorder event fired immediately after initialize
Reorder event fired immediately after initialize
Link to test case: https://jsfiddle.net/sespler2/th8pzo1b/3/
You will have to reorder one of the columns to see the event fire on reload.
Description of problem: I am trying to hook into the column reorder event, which I have done successfully, only when the page loads and the DataTable initialized, a 'columns-reordered' event is immediately fired.
I'm trying to listen to the column reorder as a sign of user input, so this obviously causes some issues because the user is not changing the order, but the event is fired.
How come this event is fired every on load? And is there a way to disable this?
This question has an accepted answers - jump to answer
Answers
This is due to the use of
stateSave. The Datatables initializes and loads the saved state. Once initialized, ie,initCompleteexecutes, the loaded state is applied. Useready()to create thecolumns-reorderedevent. Updated test case:https://jsfiddle.net/0jrcsef8/
Kevin
Thank very much Kevin