Column Sorting with CheckBox.

Column Sorting with CheckBox.

MacManMacMan Posts: 15Questions: 0Answers: 0
edited January 2014 in DataTables 1.9
Hi
My table has 12 columns. The first 2 are alpha / numberic values and sorting works fine on those.
The last to are select dropdowns, I've got the sorting working fine on those 2.

I've not managed to get any sorting on the columns with checkboxes. The console shows no errors or warnings.

This is the code I've got :

[code]
/* Create an array with the values of all the checkboxes in a column */
$.fn.dataTableExt.afnSortData['dom-checkbox'] = function ( oSettings, iColumn )
{
return $.map( oSettings.oApi._fnGetTrNodes(oSettings), function (tr, i) {
return $('td:eq('+iColumn+') input', tr).prop('checked') ? '1' : '0';
} );
}
[/code]


and
[code]
"aoColumns": [ null, null,
{ "sSortDataType": "dom-checkbox" },
{ "sSortDataType": "dom-checkbox" },
{ "sSortDataType": "dom-checkbox" },
{ "sSortDataType": "dom-checkbox" },
{ "sSortDataType": "dom-checkbox" },
{ "sSortDataType": "dom-checkbox" },
{ "sSortDataType": "dom-checkbox" },
{ "sSortDataType": "dom-checkbox" },
{ "sSortDataType": "dom-select" },
{ "sSortDataType": "dom-select" }
]
[/code]

each row is a then each checkbox is made using code similar to this :

[code]




[/code]

Any way I can get it sort on these columns. My selects are made is a very similar way and work fine.
I've tried removing the that didn't help.

Thanks

Replies

  • MacManMacMan Posts: 15Questions: 0Answers: 0
    edited January 2014
    SORTED.

    Changed
    [code]


    [/code]

    To
    [code]




    [/code]
This discussion has been closed.