lundi 2 mars 2015

JQuery Multiple Operator Checkbox Filter


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



  1. Item A (data-category="Men South Tom")

  2. Item B (data-category="Women South Tom")

  3. Item C (data-category="Men North John")

  4. Item D (data-category="Men South East John")

  5. 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



  1. Item A

  2. Item D





Aucun commentaire:

Enregistrer un commentaire