Hiding Columns Using 'visible: false' Is Disabling Filters

Hiding Columns Using 'visible: false' Is Disabling Filters

BrianA12BrianA12 Posts: 18Questions: 2Answers: 0

Hi,

Please find a test case here: http://live.datatables.net/ruhixelu/5/edit?html,css,js,console,output

The attached test case is a very simplified version of my project, just to show what my problem is.

My datatable has a filter in each column (some are text inputs , some select menus, some date inputs, etc.) I have also added text boxes/toggle buttons to toggle - hide/show columns (Name and Position in the test case). Recently, I needed some of my columns (column 0 - Name and column 1 - Position) to be hidden by default, so I did the following:

"columnDefs": [ 
        {
            "targets": [0,1],
            "visible": false,
        },
                    
  ],

The problem is that when toggling the checkboxes to show the columns (columns 0 and 1 - Name and Position), the filter input is not shown.

  • How can I fix this problem please? Obviously, I need the filters for both the Name and the Position to appear in the header when these two columns are toggled/shown.

Thanks in advance for your help,

Brian

Replies

This discussion has been closed.