metafizzy / isotope

:revolving_hearts: Filter & sort magical layouts
https://isotope.metafizzy.co
11.03k stars 1.42k forks source link

Filter multiple sections on a page #1649

Closed senojeel closed 1 year ago

senojeel commented 1 year ago

I have a single filter on a page. I am wanting to hide the sections that don't have any results in them after the filter is applied. I can't seem to figure it out.

Here is my staging site and Campus filter is at the top. https://dev.cschurch.ca/staff

I have tried using the examples I have found about adding a no results message, but those won't work because I have multiple sections.

Any ideas?

jybleau commented 1 year ago

Hello, how I would try to acheive that is by including each header as the first element of each related grid. That way they can be filtered out like the rest of the elements of the same grid.

thesublimeobject commented 1 year ago

@senojeel — The best way to do this would probably be to use the event binding for arrangeComplete, then access the Isotope data (or even the click event, really) in order to see which filters are being used. Once you have this information, you could manually hide the sections/headings that you need to hide for the currently selected filter.