DataTables 1.10.1 and ColReorder sort indication problem
DataTables 1.10.1 and ColReorder sort indication problem
hubo
Posts: 45Questions: 14Answers: 0
I am using DataTables 1.10.1 with ColReorder 1.1.1 and after columns reorder and clicking to sort by that column, it indicates sort on wrong column (probably column index is not updated after reorder).
This discussion has been closed.
Answers
I find out, that the index is updated, but it is offset by 1 to the left or right.
It occurs when I use DataTable with jQueryUI: true.
The attribute aria-sort="ascending/descending" is set to the right column, but class "sorting_asc/sorting_desc" is set to the wrong one.
Latest DataTables 1.10.1 and ColReorder 1.1.2 still has this problem.
Works okay for me with the currently nightlies of DataTables and ColReorder. If it isn't working for you, please link me to a test page showing the issue, using the nightlies of ColReorder and DataTables. The nightly are available on the downloads page.
Allan
OK, I have made an example.
Key condition is DataTables with jQueryUI: true.
When you reorder columns and click on the header to change order of rows, wrong header is marked as ordered by.
Whilst I have creating this example, I find out another bug you can see. After reorder the data-order on one of the columns creates an error dialog.
http://live.datatables.net/vajoxis/12/edit?html,css,js,output
Fix for the HTML5 data attributes committed here. Thanks for letting me know about that.
Allan
Great, data-order problem looks fixed. Now the main jQueryUI: true problem remains.
Are you aware that this bug is still not fixed?
The JUI one? Yes. I'll fix it when I get a chance to do so. At the moment I've got a significant back log and I might not get to it for a little while.
Allan
This code can help to avoid this problem:
Actually, the ColReorder contains very similar code except that the listener is added with "i" parameter instead of "oSettings.aoColumns[i]._ColReorder_iOrigCol".
So, the code above is a workaround for this problem
This code can help to avoid this problem:
Actually, the ColReorder contains very similar code except that the listener is added with "i" parameter instead of "oSettings.aoColumns[i]._ColReorder_iOrigCol".
So, the code above is a workaround for this problem
Actually, my mistake - the code above will not much help with this issue. It looks like it helps with sorting, but there is also the minor problem that some columns are get sorted only on second click (not on the first click). And the code above actually uses some wrong concepts in this plugin.
Alternativelly, the proper fix in my opinion would be the following (dataTables.colReorder.js):
and right before the triggering 'column-reorder' event (the fix is surrounded with the todo comments):
The indication problem is solved in DataTables 1.10.4 and ColReorder 1.1.2, but when I change the column order the data are not ordered by the right column.