Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82273

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

$
0
0

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


Viewing all articles
Browse latest Browse all 82273

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>