Filtering by checkbox

Filtering by checkbox

markdmarkd Posts: 1Questions: 0Answers: 0
edited February 2012 in General
I have a table built from raw html, the first column of each row has a checkbox. I have a mass select option that has this click handler
[code]
$('#mass-select').click(function()
{
$('input', Table.fnGetNodes()).attr('checked',this.checked);
});
[/code]

I also have some radio buttons so i can show all, selected or unselected and have added this custom filter

[code]
$.fn.dataTableExt.afnFiltering.push(function( oSettings, aData, iDataIndex )
{
if(Table)
{
var flag = $('#selfilter input:checked').val();

// i'd like to do $(aData[0]).attr('checked')
// but aData[0] seems to hold what the initial html was rather than what it is there currently
// so i end up having to do this to get the current html of the checkbox which is really slow
var checkbox = $("#"+$(aData[0]).attr("id"), Table.fnGetNodes());

switch(flag)
{
case "selected":
return checkbox.attr("checked") == "checked";
break;
case "notselected":
return checkbox.attr("checked") != "checked";
break;
}
}
return true;
});
[/code]


Anyone have any suggestions to get around this, i feel i'm missing something here.
This discussion has been closed.