I'm using this great plugin for my tables. I want to sort by a column that is a checkbox. Reading the info and some posts I did this:
In my view page (mvc) I've 12 columns where the 12th is a check box.
Here is how a Init my table:
I'm also using this for the sorting:
When I try to sort that column, I receive the following error:
DataTables warning: (table id='table'): Returned data sort array (col11) is the wrong length. I can't solve it. Help!
In my view page (mvc) I've 12 columns where the 12th is a check box.
Here is how a Init my table:
<script type="text/javascript"> $(document).ready( $('table').dataTable({ "bJQueryUI": true, "sPaginationType": "full_numbers", "aoColumns": [ null, null, null, null, null, null, null, null, null, null, null, { "sSortDataType": "dom-checkbox" }] }) ); </script>
I'm also using this for the sorting:
$.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; };
When I try to sort that column, I receive the following error:
DataTables warning: (table id='table'): Returned data sort array (col11) is the wrong length. I can't solve it. Help!