pavikumbhar / jquery-datatables-column-filter

0 stars 1 forks source link

Datatables show/hide columns disturbs column filtering #162

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm trying to set up data tables with column filtering and show/hide 
functionality. It seems to work fine when the selection of columns is in 
ordered way like 0,1,2,3,4,5 but the Individual column filter mixes up with 
common search function when selecting columns in unordered way like 0,1,2,3,6. 
In this instance when column filter 6 is searched it behaves like a common 
search function.

On inspecting the requests in fire bug column filter 6 values are passed in 
sSearch instead of sSearch_6. Here is my code:

$(document).ready(function () {

  var table=  $("#data_table").dataTable({
        "bDestroy":true,
        "bStateSave": true,
        "aaSorting": [[1, "asc"]], 
        "bProcessing": false,
        "bServerSide": true,
        "sAjaxSource": "/queryDb",
        "bJQueryUI": true,
        "bAutoWidth": false,
        "bFilter":true,
        "bLengthChange": true,
        "bPaginate": true,
        "bSort": true,
        "iDisplayLength": 10,
        "bInfo": true,
        "sPaginationType": "full_numbers", 
        "fnDrawCallback" : function() {

    }

    }).columnFilter({
        sPlaceHolder: "head:after",
        aoColumns: [ { type: "text" },
                     { type: "text" },
                     { type: "text" },
                     { type: "text" },
                     { type: "text" },
                     { type: "text" },
                     { type: "text" },
                     { type: "text" },
                     { type: "text" },
                     { type: "text" }
                     ]
                     });
                     }); 

Functions for show/hide:

function fnShow(iCol)
{
    var oTable = $("#data_table").dataTable();
    var bVis = oTable.fnSettings().aoColumns[iCol].bVisible;
    oTable.fnSetColumnVis( iCol, true );
}
function fnHide(iCol2)
{
    var oTable2 = $("#data_table").dataTable();
    var bVis = oTable2.fnSettings().aoColumns[iCol2].bVisible;
    oTable2.fnSetColumnVis( iCol2, false );
}

Kindly help me in resolving this bug.

Original issue reported on code.google.com by prit4...@gmail.com on 25 Jun 2014 at 2:45