Re-sorting columns after drag-n-drop column order change

Re-sorting columns after drag-n-drop column order change

magyarimikimagyarimiki Posts: 2Questions: 1Answers: 0

hi,

I'm new to DataTables and have an issue with colReorder.
I have a table with multiple columns. The columns can be reordered (except the last one, fixed using fixedColumns). The goal is to have the rows ordered first by col1, then by col2 etc, regardless of which column represents which field. So if the user drags let's say column 5 to column 2, I would like the table to be automagically re-ordered so once again the ordering is by col1, col2, col3, etc.
Please provide me a hint how I can do this.
I have tried to set orderFixed for the table, but it seems no re-ordering is done after a column drag.
Next I have tried to add an event listener for 'column-reorder' and call order.fixed() on the event but this makes the dragging to behave weird: the first drag works (however re-ordering is not done), but for many subsequent drags, if I start dragging a column header, the dragged item changes to one of the other headers while moving.
So I am definitely doing something wrong. Any pointers are welcome!

Answers

This discussion has been closed.