colReorder fnOrder doesn't recalculate data-column-index properly
colReorder fnOrder doesn't recalculate data-column-index properly

Hey Allan,
I have noticed that there is a difference between reordering the columns using the mouse and calling fnOrder manually.
The problem is that when you call fnOrder manually it updates the data-column-index attribute but that doesn't update the jQuery data model.
"_fnSetColumnIndexes": function ()
{
$.each( this.s.dt.aoColumns, function (i, column) {
$(column.nTh).attr('data-column-index', i);
} );
}
notice the attr call in _fnSetColumnIndexes. All you need to do is add a jQuery data call to the mix and it updates it properly.
"_fnSetColumnIndexes": function ()
{
$.each( this.s.dt.aoColumns, function (i, column) {
$(column.nTh).attr('data-column-index', i);
$(column.nTh).data('column-index', i);
} );
}
Hope this helps.
David
This discussion has been closed.
Replies
This is because according to the jQuery documentation.