How can I determine if a column is Searchable?
How can I determine if a column is Searchable?
alexcheveau
Posts: 2Questions: 1Answers: 1
I'm using datatables.mark.js for highlighting the search in my datatables, but the plugin mark all columns including ones with searchable = false. I want to fix the plugin to mark only nodes inside columns with searchable = true.
Thanks in advance.
The code that mark the dt from the plugin:
var globalSearch = this.instance.search();
$(this.instance.table().body()).unmark(this.options);
this.instance.columns({
search: 'applied',
page: 'current'
}).nodes().each(function (nodes, colIndex) {
var columnSearch = _this2.instance.column(colIndex).search(),
searchVal = columnSearch || globalSearch;
if (searchVal) {
nodes.forEach(function (node) {
**$(node).mark**(searchVal,
// compatibilizar com a opção 'smart = false' do dataTable.Search
{ "separateWordSearch": false });
});
}
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Ok, i managed to fix it with this code: