Can searching and columnDefs be used together
Can searching and columnDefs be used together
dotpy
Posts: 1Questions: 1Answers: 0
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
}],
Answers
Setting
searching
to 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 havesearching
set true which is the default. The default value ofcolumns.searchable
is 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
layout
option to remove the search input by settingtopEnd: null
false. Next you will need to applycolumns.searchable
false 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