afnFiltering bug - complete test case attached (works with 1.9.2 but not 1.9.4)
afnFiltering bug - complete test case attached (works with 1.9.2 but not 1.9.4)
afarber
Posts: 53Questions: 0Answers: 0
Hello,
below is the test case which works for dataTables 1.9.2, but fails for 1.9.4.
It uses DOM, but I see same behaviour with external JSON source too.
The code is also available as my answer to the
http://stackoverflow.com/questions/8052976/jquery-datatables-how-to-filter-dom-rows-when-clicking-checkboxes
Thank you
Alex
[code]
@import "http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css";
$.fn.dataTableExt.afnFiltering.push(
function(oSettings, aData, iDataIndex) {
var isFruit = (aData[0] == 'fruit');
return (isFruit ? $('#fruit').is(':checked') :
$('#candy').is(':checked'));
}
);
$(function() {
var my_table = $('#my_table').dataTable( {
bJQueryUI: true,
aoColumns: [
/* type */ { bVisible: false,
bSearchable: false },
/* thing */ null
],
});
$(':checkbox').click(function() {
my_table.fnDraw();
});
});
What should be shown:
fruit
candy
Type
Thing
fruitapple
fruitbanana
fruitpear
candyjelly
candytoffee
candyfudge
[/code]
below is the test case which works for dataTables 1.9.2, but fails for 1.9.4.
It uses DOM, but I see same behaviour with external JSON source too.
The code is also available as my answer to the
http://stackoverflow.com/questions/8052976/jquery-datatables-how-to-filter-dom-rows-when-clicking-checkboxes
Thank you
Alex
[code]
@import "http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css";
$.fn.dataTableExt.afnFiltering.push(
function(oSettings, aData, iDataIndex) {
var isFruit = (aData[0] == 'fruit');
return (isFruit ? $('#fruit').is(':checked') :
$('#candy').is(':checked'));
}
);
$(function() {
var my_table = $('#my_table').dataTable( {
bJQueryUI: true,
aoColumns: [
/* type */ { bVisible: false,
bSearchable: false },
/* thing */ null
],
});
$(':checkbox').click(function() {
my_table.fnDraw();
});
});
What should be shown:
fruit
candy
Type
Thing
fruitapple
fruitbanana
fruitpear
candyjelly
candytoffee
candyfudge
[/code]
This discussion has been closed.
Replies