Non-standard filtering
Non-standard filtering
This is a somewhat thorny problem. I have a table where each row has one category. I also have, elsewhere on the page, checkboxes for each category. Every time a checkbox is checked or unchecked I fire an event containing as data the state of the checkbox and the category. What I want to do is to filter the table according to which checkboxes are checked.
The approaches I though of are:
1. Using table.fnFilter. Since the function has no memory of which filters were applied before that's not practical.
2. Keeping a record of the state of the checkboxes. This breaks decoupling of the checkboxes and table.
3. Add an attribute to each row containing the category and write a custom filter based on that. Again, since the sorting function has no memory I'll have to either keep a memory of what filters were applied in the past or query the checkboxes.
Is there any way of solving this more elegantly?
The approaches I though of are:
1. Using table.fnFilter. Since the function has no memory of which filters were applied before that's not practical.
2. Keeping a record of the state of the checkboxes. This breaks decoupling of the checkboxes and table.
3. Add an attribute to each row containing the category and write a custom filter based on that. Again, since the sorting function has no memory I'll have to either keep a memory of what filters were applied in the past or query the checkboxes.
Is there any way of solving this more elegantly?
This discussion has been closed.
Replies
Allan
Yes the filer will be applied every table the table is drawn. Thus if you want a cumulative filer, you need to take that into account in your filtering code :-)
Allan