Filter rows by CSS selector
Filter rows by CSS selector
Example fiddle: http://live.datatables.net/gamuxure/1/edit
I'm using documentTable.rows('selector-string')
to grab rows matching a CSS selector, then attempting to filter the table by chaining .draw()
on that.
That appears to not be the right thing, as the table doesn't appear to change. No errors in the console, unfortunately. I'm tasked with fixing up one page on an existing site, so I'm afraid I don't fully understand the DataTables API even after browsing the docs.
This question has an accepted answers - jump to answer
Answers
[deleted]
DataTables filtering is string based - there isn't a trivial way to have it display rows based on a CSS selector (you can easily select rows as you have done, but not reduce the display down to that).
Are you able to change the table so that
data-category
anddata-type
are actually columns in the table (which you can hide usingcolumns.visible
)? If so, that is the way I would suggest you do it then you can easily usecolumn().search()
.If that isn't an option you would need to use a custom search plug-in.
Allan
Sure, I can try that. Thank you.