Row reorder doesn't work with column ordering
Row reorder doesn't work with column ordering
I have to order a column and the change the order of the columns by dragging a row one by one and placing them . But after ordering the table by a column the row order doesnt work. whenever i drag row to its new position and drop it it goes back to it's old position.
Following is my datatable Init code
var tableOpts = {
paging: false,
deferRender: true,
searching: false,
scrollCollapse: true,
scrollY: 1000,
rowReorder: true,
data: array,
};
$('#table').DataTable(tableOpts );
Is there something wrong with the initialization or it's a bug?
Answers
Correction: I have to order the table according to a column and the change the order of the rows by dragging a row one by one and placing them.
The RowReorder docs explain how the process works. Typically you will want an numeric index column used as the dataSrc RowReorder uses for the data swap and you will want this column to be the Datatable order. If you order the table differently then it will look like RowReorder is not working as the table will be ordered by the other column. This example me help:
https://datatables.net/extensions/rowreorder/examples/initialisation/restrictedOrdering.html
Maybe I'm misunderstanding your question. If the above doesn't help please put together a simple test case replicating the issue.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin