Susanne92
Susanne92

Reputation: 217

jQuery Datatables Columnfilter - external filter is not working on hidden column

I have a table with 2 columns. 1 column is hidden and I want to apply an external select-filter for it. The filter and the table are working fine - but the filter applys only for the visible column.

How can I apply the filter directly for the hidden column?

 $('#example').dataTable({          
                "aoColumns": [                              
                    /* Region JUST FOR EXTERNAL FILTER*/ { "bVisible":false},                       
                    /* Babys */    null         
                    ],                  
            });                 

        $('#example').dataTable().columnFilter({            
                     sPlaceHolder: "head:before",
                    aoColumns:[
                    { sSelector: "#regionFilter", type: "select"  },
                                        ]}
                    );

Upvotes: 0

Views: 2215

Answers (1)

johnnyw
johnnyw

Reputation: 81

You have to add

 "bUseColVis": true,

into your code!

It should look like:

$('#example').dataTable({          
                "aoColumns": [                              
                    /* Region JUST FOR EXTERNAL FILTER*/ { "bVisible":false},                       
                    /* Babys */    null         
                    ],                  
            });                 

        $('#example').dataTable().columnFilter({            
                     sPlaceHolder: "head:before",
                    //ADD IT HERE
                    "bUseColVis": true,
                    aoColumns:[
                    { sSelector: "#regionFilter", type: "select"  },
                                        ]}
                    );

Upvotes: 4

Related Questions