patrickkunka / mixitup

A high-performance, dependency-free library for animated filtering, sorting, insertion, removal and more
Apache License 2.0
4.52k stars 737 forks source link

Feature-Request: Filtering with OR && AND #254

Closed JonathanSchndr closed 7 years ago

JonathanSchndr commented 8 years ago

Hi guys,

it is possible to filtering multi-dimensional, with OR && AND? This is possible: (green or blue) AND (square or circle) -> DEMO: http://codepen.io/patrickkunka/pen/ltgde (https://mixitup.kunkalabs.com/learn/tutorial/advanced-filtering/#multi-dimensional-filtering)

but i need (green or blue) AND (square and circle). yes right - a item thats like a square and circle at the time is impossible. another example: you filtering icecreme: the ice can be sherbet, creme or slush. but need at the same time gluten-free AND lactose-free --> (sherbet or creme or slush) AND (gluten-free and lactose-free)

workaround? solution? or not possible at the moment? thanks for your time!

patrickkunka commented 8 years ago

Hi Jonathan.

Thanks for your question. Unfortunately the boilerplate code in codepen demo only works for the logic you described above.

However, you could certainly write your own code to concatenate your filters together as per your desired logic, and then send the final selector string along to MixItUp via its API (as we do in the codepen demo).

You'd need a final selector that looks something like this from the sound of it:

.green.square, .green.circle, .blue.square, .blue.circle

I'm actually working towards a multi-fitering extension which should drastically simplify all this sort of stuff, and will hopefully release later in the year (after mixitup v3), so I'll certainly update you when that's available.

JonathanSchndr commented 8 years ago

HI @patrickkunka, thank you for your fast reply. That sounds great.

patrickkunka commented 7 years ago

Hi again Jonathan.

You might want to checkout the new MultiFilter extension for MixItUp 3.