*BUG* found in "live DOM sorting example". Filtering checkboxes returns them to default value
*BUG* found in "live DOM sorting example". Filtering checkboxes returns them to default value
From the Live Sorting example @ http://datatables.net/examples/plug-ins/dom_sort.html
If you change the default value of any of the checkboxes then use the "Search:" filter the checkboxes return to their default state (seems to only affect IE6). This happens when using the example code (below). Maybe there's an alternative to work around this?
[code]/* Create an array with the values of all the checkboxes in a column */
$.fn.dataTableExt.afnSortData['dom-checkbox'] = function ( oSettings, iColumn )
{
var aData = [];
$( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
aData.push( this.checked==true ? "1" : "0" );
} );
return aData;
}[/code]
If you change the default value of any of the checkboxes then use the "Search:" filter the checkboxes return to their default state (seems to only affect IE6). This happens when using the example code (below). Maybe there's an alternative to work around this?
[code]/* Create an array with the values of all the checkboxes in a column */
$.fn.dataTableExt.afnSortData['dom-checkbox'] = function ( oSettings, iColumn )
{
var aData = [];
$( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
aData.push( this.checked==true ? "1" : "0" );
} );
return aData;
}[/code]
This discussion has been closed.
Replies
The best that could be done is to have a live event handler on the checkboxes and to store a list of the checkboxes and their state - then in fnDrawCallback go through all checkboxes and restore their state.
Horrible solutions, but its the only one I've found when I've worked on this issue in the past.
However, as you say, this should only effect IE6.
Allan