Can searching and columnDefs be used together
Can searching and columnDefs be used together
Can/Should https://datatables.net/reference/option/searching and columnDefs be used together, e.g?
"searching": false,
"columnDefs": [{
"searchable": true, "targets": 1,2,4,6
}],
This discussion has been closed.
Answers
Setting
searchingto false does two things; first it disables Datatables searching and second it eliminates the display of the global search input.First it should be an array of targets, for example
"targets": [1,2,4,6]. For this to work you need to havesearchingset true which is the default. The default value ofcolumns.searchableis true. You will need to turn off the columns you don't want to search.If you want to remove the global search input but search only certain columns then use the
layoutoption to remove the search input by settingtopEnd: nullfalse. Next you will need to applycolumns.searchablefalse to the columns you don't want to search. You can use an array of column indexes or set a class name on theth, ieno_search, for the columns you don't want to search. Use the class name in thecolumnDefs.targets. For example:https://live.datatables.net/nivivade/1/edit
Kevin