combining filters

combining filters

patricpatric Posts: 6Questions: 0Answers: 0
edited May 2012 in General
Hello,

I'm having trouble understanding the filtering mechanism.

My goal is to apply an optional, persistent filter in addition to DataTables' default search:

[code]
[ search ]

| Name | Primary Color | Secondary Colors | ... |
| ... | blue | red, white | ... |
| ... | yellow | | ... |
| ... | black | purple | ... |
| ... | green | red, blue, yellow | ... |

color:
[ ] red [ ] green [ ] blue [ ] ...
[/code]

If the user selects any of the color checkboxes at the bottom, a column-agnostic filter should be applied permanently in addition to whatever is entered in the search field.

I can do the filtering by calling fnFilter - but then using the default search field afterwards effectively removes that filter.

I suppose the correct solution is to add a function to afnFiltering - but I'm not sure how to filter values across columns without effectively reinventing fnFilter.

Any tips would be appreciated!

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    What is the difference between http://datatables.net/examples/api/multi_filter.html and the thing you would like to achieve? It appears to me that your 'color' checkboxes do the same as the individual column inputs in that example. In that example, the individual column inputs and the global search input cooperate.
  • patricpatric Posts: 6Questions: 0Answers: 0
    I think you're right, I might have been overthinking it, getting myself confused along the way. I'll take a closer look at the multi-filter code.

    Thanks!
This discussion has been closed.