Filtering based on row class
Filtering based on row class

Hi there,
I'm building out some filtering mechanisms for our DT instances. I've been referencing these two items to build my assumptions for the approach:
- https://datatables.net/examples/api/regex.html
- https://datatables.net/examples/api/multi_filter_select.html
and have written some early stage code to confirm.
One of the filters, however, that we'd like to include are related to the information within a particular row. When the rows are built they are given a class to indicate that it's overpriced, needs more information, etc. with simple classes like empty
, flagged
, and the likes.
I"d like to include these as filters as well. So far I'm not seeing any means of directly connecting this row class to the search
method. Am I overlooking it? Or will I need to go another route such as hiding/showing the rows with regular old jQuery? Or, on the other hand, just throw some invisible columns in at the end of the table that have 0/1 to indicate the same issues as the classes do and then process it based on that.
Thanks for any help in thinking through this!
This question has an accepted answers - jump to answer
Answers
To use information from the DOM you would need to use a custom filtering method.
Plug-ins can be used to build arbitrarily complex filters since you are in complete control of the data and the nodes. I keep meaning to getting around to write a fuzzy matching filter for example :-)
There is an example available here.
Allan
Awesome. Sounds like a plan. Thanks for pointing me in the right direction!