cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
pepeday
Level: Powered On

Filtering a gallery with a drop down

So this isn't a question, it's a bit of a workaround I came up when wanting to filter a gallery using a dropdown.

The main problem faced was how to disable the filter, as in give the option to the user to turn the filter on and off. The easiest way I've found is as below.

Filter(collection, item_id=item_id*!toggle. Value+dropdown.selected.item_id*toggle.value).

How the above works is when the toggle is set to off, the item_id is set equal to item_id, and as such all the records are shown. If it's set to on, item_id is set to equal the selection of the dropdown, voila!

There's a couple of caveats, essentially if there are records that the item_id is set to 0 or blank then these show up whether is filter is enabled or not.

On the other hand, the coding is very streamlined and there's no delegation warnings with this method (so I assume that the formula is delegable).

That's all.
2 REPLIES 2
Super User
Super User

Re: Filtering a gallery with a drop down

Hi @pepeday,

I like to use a context variable to create an alias for the entire formula using the UpdateContext() Function. I then use the variable as the Items property of a gallery. I then can redefine the variable easily as the OnSelect property of a button, checkbox, toggle or icon by substituting another formula in the UpdateContext() function.

pepeday
Level: Powered On

Re: Filtering a gallery with a drop down

Touch of genius right there! Can also work much better in some cases than my solution. Awesome and thanks @Drrickryp