Forum Academy Marketplace Showcase Pricing Features

Sort or filter repeating group with buttons

Hi! I’m trying to sort/filter repeating group (tables of items) with a click of a button. So for instance, I would click on “Newest Items” the “table of items” sort with newest created items to the oldest. or If I click a button that says “Red” It would sort the “table of items” with only red stuff with newest created item first. Is there anyway to do this? I was able to achieve something similar using drop down via search but can’t seem to find a way with using buttons… Please help!

3 Likes

It’s definitely possible, you should consider using custom states. For example, if Button A is active, then the repeating group data source changes to include the filter. I’m on my mobile at the moment, but I could draw it out later. Start with custom states

Awesome. Custom state as in, create a conditional for the button?

This shows the mechanism for list filtering.

https://buildingonbubble.com/block/dynamically-filter-a-list-1458840720641x659248893977690100

3 Likes

This worked! However is there anyway to use a button instead of repeating group? Especially since the texts are dynamic… For instance If I want to create a tab above a “repeating group” with 3 buttons: Newest, Most Popular, Trending. Is this possible?

Using your three buttons, create a workflow for each button so that when that button is pressed the workflow changes the page’s Custom State.
But now instead of the “Value” being “Current Cell’s Text” make the Value for the “Newest Button” simply the text “Newest”
Then go into the conditions of the repeating group you want filtered and say that "When page’s Custom State is “Newest”, make the Data source filtered the way you want. Do this for each button and remember to make a condition on the repeating group for each state

1 Like

Or use the “Display List” action to show the list you want based on the button click.

https://buildingonbubble.com/block/filter-a-list-with-buttons-1469562701768x293160540320038900

1 Like

Thanks guys! Got it to work! Cheers!:grinning:

2 Likes

…and I spoke too soon… Little problem… When I toggle between, in this case… “Newest” and “Jumping” The repeating box doesn’t seem to reset… So, it the works first time you click on it… but after 2nd time, it doesn’t work… it just get stuck on Jumping… which only shows 1 listing… not sure what the problem is…

it looks like when you are setting the custom states, you are applying them to different elements - they should be the same element with a different state. I usually set a state on the Parent Group or the Page’s Group, not a custom state for an individual button.

So when you click “Newest” it changes the data set, but when you click “Jumping” it is changing the state of a separate element. Your first element is still in the “Newest” state.

And @NigelG is correct, you can use Display list. Or you can use Hide and Show workflows. I usually use conditions and states as I thought it is best if you want to keep # of workflows lower

1 Like

Yep! That seemed to have fixed the problem. Thanks, guys!

2 Likes