Yohanan Baruchel Yohanan Baruchel - 2 months ago 38x
jQuery Question

Datatables rowreorder moves only by one line

I am having a problem with jQuery Datatables, just added

option to my table, the problem is that when I drag and drop the selected row it moves only by one row. The option that I used was:

rowReorder: true,


Tried looking at the documentation or answers but didn't find a solution.


You need to have a column or data property with a sequence number. By default, RowReorder extension is looking for it in the first column.

In the basic initialization example, it says:

The first column in the table is a sequence number that provides the basis for the ordering.

If you don't want to display sequence number in the table, you can also specify data source for sequence number with rowReorder.dataSrc.

There are couple other issues with your code, for example, ordering should not be disabled with order: false. Also there is a typo in columnDefs option name.

See updated example for code and demonstration.