Dynamically changing the filter settings of a list

Hello, I was hoping this was maybe possible with Custom Actions, but it doesn’t appear so.

I simply want to use one list, but change its filter settings when I push a button. A “Dropdown” wouldn’t look great UX wise. I’d rather press a button and either affect a list directly, or perhaps do this programmatically.

Is there a way to change a list’s filter dynamically?

There are a couple of ways I’ve been able to work around this, depending on the exact scenario you’re trying to do (these might not work for you, I don’t know the exact use case)

First way is to create duplicate lists for each filter (so if you have 3 filtering options, you’ll have 3 lists), a text input that you make transparent so it’s not visible, and the buttons for the filters. The lists will all be “sometimes visible” if the text input is equal to some corresponding value (ie. 1st list if input = 1, 2nd if it equals 2 and so on). Then make the actions on each button change the text input to the corresponding number (or whatever you set the condition to be in the text input).
Example: you want a list of businesses to be filtered by either restaurants, office buildings, or barber shops. You have list 1 filtered to show restaurants, 2 to show office buildings and 3 for barber shops. Then set the visibility for the 1st to only visible if text input = restaurants (or text input = 1) and repeat the same for the other 2. Then make action for the button that says restaurants “change input value” to restaurants (or 1, depending on the visibility rule you made), and repeat for the others. If everything is laid out right, it’ll perfectly switch between them every time you click one of the buttons.

Option 2 If you have a similar set up with the text input changing to match what the button pressed says (this one you’d probably go with “restaurant” instead of “1”), then in the database either make a text field to classify the type of business or make a separate collection of business types and do a many to one relationship between businesses and business types. Once all of the businesses have been classified, its super easy to do filtering, just use one list and have the filter condition “Business Type is equal to text input” or “Business’ > Business Type’s > Name” is equal to text input", it’ll achieve the same thing when you click the buttons, without switching between lists.

Again, I don’t know the use case and specifics, so this might not be a viable option for you, but these are the 2 ways I’ve been able to do filtering in a lot of different features. Hope this helps!


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.