Jquery Datatable : Clicking on a column sorts data for the next column in the sequence

Jquery Datatable : Clicking on a column sorts data for the next column in the sequence

Prasanna89Prasanna89 Posts: 1Questions: 1Answers: 0
edited September 2014 in Free community support

HTML:
A table containinig 7 columns with first column contains checkboxes. Table's body is empty and I am constructing that with ajax postpack.

Jquery:

var oSTable = $('#Btable').dataTable({
"bDestroy": true,
"bJQueryUI": true,
"bProcessing": true,
"bPaginate": true,
"bServerSide": true,
"bFilter": false,
"iDisplayLength": gridCnt,
"sAjaxSource": "/Controller/Search",

    "fnServerParams": function (aoData) {
        aoData.push({passing  5 parameters here }

            );

    },
    "aoColumnDefs": [
         {
             "bSortable": false,
             "aTargets": [0],
             "mData": "SlNo",
             "mRender": function (data, type, full) {
                 return '<input type="checkbox" value="' + data + '"/>';
             }
         },
       {
           "bSortable": false,
           "aTargets": [6],
           "mData": "S",
           "mRender": function (data, type, full) {
               return '<button type="button" value="'+data'">';
           }
       }
    ],
    "aoColumns": [
        { "bSortable": false, sWidth: '30px' },
      { "mData": "B1", "sClass": "center" },
      { "mData": "B2", "sClass": "center", sWidth: '200px' },
      { "mData": "B3", "sClass": "center" },
      { "mData": "B4", "sClass": "center" },
      { "mData": "B6", "sClass": "center" },
      //changed the width of column from 280 to 300px
      { "bSortable": false, sWidth: '300px' }
    ],


});

Now the problem is when I click the 2nd column it sorts the data as if I had clicked the 3rd column..and similarly for next ones too.

I want it to be sorted as per the column I clicked(common functionality).

Can anyone please help ? Ur help is much appreciated.

NB:If I dont consider the first column containing checkboxes, it works as intended

This discussion has been closed.