Can I hide dom/text elements from search?
Can I hide dom/text elements from search?
Hello,
I'm not sure how can I bring an example for this issue, but its quite straightforward question:
I have datatables with search function. It contains column with tag elements (simple ul li
list), and under this list there option to add another tags using select dropdown.
I want the table to enable search also through the tags column. But as far I understand, the datatable looks for ANY dom element that contains the queried text. So, in our case, the search picks also the <option>[TAG_NAME]</option>
, that resides inside the <select>
element inside the cell, and therefore resulting in matched row.
Is there any possible way to add some kind of data-attribute to my select element so the search function won't pick it up?
Thank you!
Answers
One option is to use
columns.render
to set the filter option as described here:https://datatables.net/manual/data/orthogonal-data
Another option is to use HTML5 data attributes as shown here:
https://datatables.net/examples/advanced_init/html5-data-attributes.html
Kevin