search highlighting using mark.js
search highlighting using mark.js
in DataTables 2
I would like to implement search highlighting using mark.js with DataTables 2
https://datatables.net/blog/2017/search-highlighting-with-markjs#Adding-custom-mark.js-options
JS Bin test case
https://live.datatables.net/teripiyu/1/edit
I want to add custom mark.js options, such as wildcard search, but it only works when I trigger the search manually.
$("#example").mark("R*os", {
wildcards: "enabled",
caseSensitive: true
});
Using the same settings to initialize the DataTable, the search functionality in the search field is not working when typing.
var table = new DataTable('#example',
{ mark:
{ wildcards: "enabled",
caseSensitive: true
}
}
);
Answers
Maybe I'm misunderstanding the problem description. It seems the
widlcardsoption works:https://live.datatables.net/teripiyu/2/edit
Possibly you need to use
search.regexto allow for regex searching in the global search input. Best practice is to disablesearch.smartif enabling regex searching. Like this:https://live.datatables.net/yafevico/1/edit
Kevin