Sorting Checkbox with FixedColumns Error

Sorting Checkbox with FixedColumns Error

kkuehnekkuehne Posts: 1Questions: 0Answers: 0
edited February 2012 in Bug reports
Hi.

I am using Checkbox-Sorting as suggested in http://datatables.net/examples/plug-ins/dom_sort.html

When I fix the CheckBox-Column with FixedColumns I get an error on pageload and sorting:

"Requested unkown paramter '0' from the datasource for row 0"

Without fixed columns sorting works fine.

See http://futebola.de/kk/1u1/dataGrid/example.php

Replies

  • ccmp2kccmp2k Posts: 2Questions: 0Answers: 0
    Hi,

    i also faced this issue today. The method for sorting checkboxes uses the column-index to indentify the column to sort. This index seems to be broken, because the fixed columns are not recognized.

    You have to substract the number of fixed columns from the iColumn value.

    /* Create an array with the values of all the checkboxes in a column */
    $.fn.dataTableExt.afnSortData['dom-checkbox'] = function ( oSettings, iColumn )
    {
    var aData = [];
    /* iColumn -= {number of fixed columns}; */
    $( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
    aData.push( this.checked==true ? "1" : "0" );
    } );
    return aData;
    }

    This could be a quick fix until the problem is solved.
This discussion has been closed.