rowReorder is failing whie "ordering" option is declared
rowReorder is failing whie "ordering" option is declared

I'm trying to insert the rowReorder extension in a table parsed dynamically. No matter if "ordering" option is set to true or false, if i drag a row, only the cell on which i clicked is being reordered. The rest of the row reverts back to its original position.
The only way i've found to make it work is to comment out the "ordering" option, which is not acceptable to mantain a dynamical parsing design.
I even trued declaring "order: []" but it makes the script fail as well (i need to comment out this line too).
Am I missing something? Is there any additional option i need to set that is not listed in the documentation of rowReorder?
Replies
The rowReorder docs have this:
"The data point in the row that is modified is defined by the
rowReorder.dataSrc
. Normally you will want this to be a sequential number! The data reorder can potentially confuse end users otherwise!"Are you using a sequential list as described?
Kevin
Hi Kevin,
documentation says that the default value for that option is 0 (that means it will search for the index in the very first column of the DataTable).
So no: i did not specify that option but it shouldn't matter as my first column (index 0 for DataTable) contains the autoinc indexes.
And in fact, it is working perfectly if i comment out the options which I was talking about in the first message.
Please refer to this fiddle to understand better the situation: first try to order the rows leaving "ordering: false" and then try to comment it out.
I guess I'm confused about the problem. Whether ordering is on or off the result is the same. Its just displayed in a different order. Here is what I see:
ordering: false - original order:
When I move row 2 above 1 this is what I see:
Commenting ordering: false
//ordering: false - original order:
When I move row 2 above 1 this is what I see:
Same result just different order based on table ordering. What are you expecting or wanting to happen?
Kevin
I'm expecting the last result you posted.
I don't want the table to be orderable with the click over the header of the table, so i put "ordering: false", but this is leading to your first result, which is not what i need.
I see the issue now. Take a look at this post regarding
ordering: false
and rowReorder:https://datatables.net/forums/discussion/34453
You would use
columns.orderable
to turn off the users ability to order the table but have ordering enabled. For example:Kevin
I see. Hoped there was a smarter way of doing it. This way I have to disable order manually for each column.
Thanks for your help anyway!
You could use
"targets": "_all"
for all columns as described in-options columnDefs.targets
.Kevin
But that way the column containing the autoinc index will be disabled too and we'll be at the starting point...or not?
Did you try it
I think the docs for
ordering
is a bit confusing. If you setordering: false
you will not see the up arrow indicating that column 0 is sorted. In the doc it says:"This parameter is a global option - when disabled, there are no sorting actions applied by DataTables at all."
columns.orderable
only affects the user's ability to change the table order but doesn't disable Datatables ability to order the table. In the doc it says this:"Note that this option only effects the end user's ability to order a column. Developers are still able to order a column using the
order
option or theorder()
method if required."Kevin
Again Kevin: thanks
Thank you,
I ran into the same problem!