# Sort or filter repeating group with buttons

**URL:** <https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674>\
**Category:** Need help\
**Created:** [July 26, 2016, 12:05am UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674 "2016-07-26T00:05:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![nordogg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/nordogg/32/4036_2.png) [@nordogg](https://forum.bubble.io/u/nordogg)\
**Post date:** [July 26, 2016, 12:05am UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674/1 "2016-07-26T00:05:10Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![andrewgassen](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/andrewgassen/32/44248_2.png) [@andrewgassen](https://forum.bubble.io/u/andrewgassen)\
**Post date:** [July 26, 2016, 12:30am UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674/2 "2016-07-26T00:30:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nordogg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/nordogg/32/4036_2.png) [@nordogg](https://forum.bubble.io/u/nordogg)\
**Post date:** [July 26, 2016, 2:00am UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674/3 "2016-07-26T02:00:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [July 26, 2016, 7:44am UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674/4 "2016-07-26T07:44:12Z")

</div>

This shows the mechanism for list filtering.

[https://buildingonbubble.com/block/dynamically-filter-a-list-1458840720641x659248893977690100](https://buildingonbubble.com/block/dynamically-filter-a-list-1458840720641x659248893977690100)

---

<div class="post-metadata">

**Author:** ![nordogg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/nordogg/32/4036_2.png) [@nordogg](https://forum.bubble.io/u/nordogg)\
**Post date:** [July 26, 2016, 6:00pm UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674/5 "2016-07-26T18:00:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![gf\_wolfer](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/gf_wolfer/32/262456_2.png) [@gf\_wolfer](https://forum.bubble.io/u/gf_wolfer)\
**Post date:** [July 26, 2016, 6:43pm UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674/6 "2016-07-26T18:43:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [July 26, 2016, 7:11pm UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674/7 "2016-07-26T19:11:38Z")

</div>

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

![](https://us1.discourse-cdn.com/bubble/original/2X/c/c69df14c1c92d765ed763b730ae73dac4af5b466.png)

[https://buildingonbubble.com/block/filter-a-list-with-buttons-1469562701768x293160540320038900](https://buildingonbubble.com/block/filter-a-list-with-buttons-1469562701768x293160540320038900)

---

<div class="post-metadata">

**Author:** ![nordogg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/nordogg/32/4036_2.png) [@nordogg](https://forum.bubble.io/u/nordogg)\
**Post date:** [July 26, 2016, 7:26pm UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674/8 "2016-07-26T19:26:29Z")

</div>

Thanks guys! Got it to work! Cheers!😀  
 ![](https://us1.discourse-cdn.com/bubble/original/2X/4/46c2ab246c337ae49c898cce51b214c706e28ee3.png)

---

<div class="post-metadata">

**Author:** ![nordogg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/nordogg/32/4036_2.png) [@nordogg](https://forum.bubble.io/u/nordogg)\
**Post date:** [July 26, 2016, 7:34pm UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674/9 "2016-07-26T19:34:13Z")

</div>

…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…

---

<div class="post-metadata">

**Author:** ![gf\_wolfer](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/gf_wolfer/32/262456_2.png) [@gf\_wolfer](https://forum.bubble.io/u/gf_wolfer)\
**Post date:** [July 26, 2016, 8:04pm UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674/10 "2016-07-26T20:04:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nordogg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/nordogg/32/4036_2.png) [@nordogg](https://forum.bubble.io/u/nordogg)\
**Post date:** [July 26, 2016, 8:52pm UTC](https://forum.bubble.io/t/sort-or-filter-repeating-group-with-buttons/4674/11 "2016-07-26T20:52:29Z")

</div>

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

![](https://us1.discourse-cdn.com/bubble/original/2X/9/9ee7ff4fce16548bafb51cc951d5a1545baa51fc.png)
