Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datatables show/hide columns disturbs column filtering #162

Open
GoogleCodeExporter opened this issue Feb 5, 2016 · 0 comments
Open

Datatables show/hide columns disturbs column filtering #162

GoogleCodeExporter opened this issue Feb 5, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 25 Jun 2014 at 2:45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant