I would like to sort (using a dropdown) a repeating group by the number of upvotes from highest to lowest and from lowest to highest. The RG displays a list of products.
I’m able to sort the RG by creation date. Upvotes are set up in the database as a “List of users” so that users can only upvote a product once.
The easiest way to do this can be to have an element state on the Repeating group that’s a yes/no field for deciding whether the sorting is highest to lowest or not.
The repeating group’s data can have an additional :sorted option to sort by number of upvotes with the value of ‘Descending’ being this state value, set as dynamic data.
:Sorted
Descending: Repeating Group’s isHighToLow
Descending = yes
means that the items will be sorted from highest to lowest and vice versa.
@blurapps It sort of makes sense, but I’m still new to Bubble so having trouble conceptualizing it. Would this a custom state? Or how would i set this up?
So basically you can store some temporary data on an element. This data is not persistent, so it will clear off when you refresh the browser.
But you can set up workflow actions in ‘on page refresh’ to set default states on your elements when someone opens your Bubble App.
The link will explain the details better than I can