I have the following data table, where status contains checkboxes that I want to be able to sort on that column
$('#aMG_permissionTable')
.dataTable({
"bJQueryUI": true,
"bPaginate": false,
"sScrollY": "440",
"bAutoWidth": true,
"bFilter": true,
"bInfo": true,
"bSort": true,
"aoColumns": [
{ "mData": "PermissionName" },
{ "mData": "PermissionWithDescription" },
{ "mData": "PermissionGroupWithDescription" },
{ "mData": "Status" }
],
"aoColumnDefs": [
{ "bVisible": false, "aTargets": [0] },
{ "sSortDataType": "dom-checkbox", "aTargets": [ 3 ] }
],
"sPaginationType": "full_numbers",
"aaSorting": [[ 0, "asc"]]
});
What I have tried:
I have tried the following, but the error is empty, when debugging it does not even enter the each loop.
$.fn.dataTableExt.afnSortData['dom-checkbox'] = function ( oSettings, iColumn )
{
var aData = [];
$( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
console.log(this);
aData.push( this.checked==true ? "1" : "0" );
} );
return aData;
};