Disabling initial sort but still having RowReorder extension work
Disabling initial sort but still having RowReorder extension work
dydx
Posts: 8Questions: 3Answers: 0
So.. I'm having this issue where reorder works well and all but when I try to disable initial datatable sort by putting order: []
. The RowReorder doesn't work as expected and whatever I drag goes back to its initial position when I drop it. So.. is there anyway to make those two work together?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
The column that is the
rowReorder.dataSrc
needs to be actively ordered. The data in that column is swapped to allow the rows to stay in their reordered positions. If ordering is turned off then the rows won't appear where expected.Kevin
So there's no way to make both of the features work together? Because I need to skip the initial ordering but want to have RowReorder working..
Thanks
Are you using an index (sequential number) as suggested in the [RowReorder docs}(https://datatables.net/extensions/rowreorder/) as the
rowReorder.dataSrc
?If you look at this example there is a sequence column. This is used to keep the table ordered. You can watch how it swaps the sequence numbers. This column can always be hidden.
Kevin
Actually this example is closer to what you are asking for:
https://datatables.net/extensions/rowreorder/examples/initialisation/restrictedOrdering.html
Kevin
Ah right.. I was using sequential data until I had to change things up and that made the data index unsequential.. Thanks man!
I have another question tho, it's different from this one.. should I create a new thread?
Please do.
Kevin