DataTables ColumnFilterWidgets and columnDefs searchable conflict

I am having a conflict when I use the ColumnFilterWidgets in the shortcode with columnDefs searchable in the Custom Commands input. I am trying to make some columns searchable and other columns filterable, however they don’t play nice together.

Custom Commands: “columnDefs”: [ { “orderable”: false, “targets”: [ 0,4,5,7,9 ] }, { “searchable”: false, “targets”: [ 0,1,5,6,7,8,9] } ]

Shortcode: [table id=12 datatables_columnfilterwidgets=true automatic_url_conversion=true datatables_columnfilterwidgets_exclude_columns=0,1,2,3,4,5,9,10 cache_table_output=true responsive=scroll filter=”Draft” filter_inverse=true /]

With this configuration the columns I choose become searchable, but the dropdown filters don’t work and the table responds with “No matching records found”.

When I remove those columns (5,6,7) from the searchable targets array then the dropdown filter works, but of course those columns now become searchable.

I understand that the “search” is actually a filter, so I assume this is where the conflict lies, but I can’t figure out the solution.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here