FixedColumns + Sorting
FixedColumns + Sorting
If you create a datatable using the FixedColumns plugin and set bJQueryUI to true, sorting one of the columns fixed by the FixedColumns plugin throws a javascript error.
You can reproduce the bug on the demo site of the FixedPlugins: http://datatables.net/release-datatables/extras/FixedColumns/themed.html.
Try sorting on the Rendering engine column, and you can see the following javascript error:
TypeError: 'undefined' is not an object (evaluating '$('span.DataTables_sort_icon', aoCloneLayout[i][j].cell)[0].className')
The error comes from the FixedColumn.js _fnClone method. It affects only the rendering of the jquery UI sort icon, sorting the rows works fine, the sorting icon wont change will always show it's default state.
I didn't had the time to go too deep into the problem, but what I saw: there is a aoCloneLayout array, and the code is trying to copy the sort classes from it's sorticon, to the dom's sorticon. But the aoCloneLayout object was created based on the this.s.dt.aoHeader object, which was the hidden thead element of the fixed body table, which had no sorticons in it, so $('span.DataTables_sort_icon', aoCloneLayout[i][j].cell) has a length of 0.
However, I fixed this by replacing this:
this.className = $('span.DataTables_sort_icon', aoCloneLayout[i][j].cell)[0].className;
with this:
for ( i=0, iLen=aoCloneLayout.length ; i
You can reproduce the bug on the demo site of the FixedPlugins: http://datatables.net/release-datatables/extras/FixedColumns/themed.html.
Try sorting on the Rendering engine column, and you can see the following javascript error:
TypeError: 'undefined' is not an object (evaluating '$('span.DataTables_sort_icon', aoCloneLayout[i][j].cell)[0].className')
The error comes from the FixedColumn.js _fnClone method. It affects only the rendering of the jquery UI sort icon, sorting the rows works fine, the sorting icon wont change will always show it's default state.
I didn't had the time to go too deep into the problem, but what I saw: there is a aoCloneLayout array, and the code is trying to copy the sort classes from it's sorticon, to the dom's sorticon. But the aoCloneLayout object was created based on the this.s.dt.aoHeader object, which was the hidden thead element of the fixed body table, which had no sorticons in it, so $('span.DataTables_sort_icon', aoCloneLayout[i][j].cell) has a length of 0.
However, I fixed this by replacing this:
this.className = $('span.DataTables_sort_icon', aoCloneLayout[i][j].cell)[0].className;
with this:
for ( i=0, iLen=aoCloneLayout.length ; i
This discussion has been closed.
Replies
Could you try the latest nightly of FixedColumns please? You can get it front he download page: http://datatables.net/download/ . This error should already be addressed in that version.
Allan
Thank You, this solved the issue.
Judit