I would like to generate a javascript-based category filter for a given list of items. The differentiator is that I need entries within each category grouping to act as an "or" operator, while each category grouping acts as an "and" operator.
I have seen examples that get close, but nothing that exactly matches the desired outcome. Is it possible to achieve this with JQuery's .filter()? Are there preferred methods to achieve this with datasets in the thousands?
Appreciate any guidance.
Scenario
Cat 1
- Men [CHECKED]
- Women
Cat 2
- North
- South [CHECKED]
- East [CHECKED]
- West
Cat 3
- Tom [CHECKED]
- John [CHECKED]
- Frank
Item List
- Item A (data-category="Men South Tom")
- Item B (data-category="Women South Tom")
- Item C (data-category="Men North John")
- Item D (data-category="Men South East John")
- Item E (data-category="Men South East Frank")
if item matches (Men) AND (Fast OR Swing) AND (Tom OR John) add to result set
Result Set
- Item A
- Item D
Aucun commentaire:
Enregistrer un commentaire