I am using Bootstrap-table's client-side search functionality. In general, it works very well; my only problem is that it does not strip formatting...
E.g., if I have a User name column and I put there a value like this:
<td><strong>Smith</strong> John</td>
Then Search will find strings "Smith" or "John", but searching for "Smith John" will match zero rows.
This can be achieved by using Custom Search.
First, add data-custom-search="customSearchMethod"
to <table>
, then implement it like e.g.:
function customSearchMethod(data, text) {
text = text.toLowerCase();
return data.filter(function(row) {
let cellText = Object.values(row).join().toLowerCase().replace(/(<([^>]+)>)/ig, '');
return cellText.indexOf(text) > -1;
});
}