Forum Academy Marketplace Showcase Pricing Features

Auto-sort images

Hello, I am new to Bubble and would really appreciate the help. I am trying to have buttons that can turn on/off picture in a repeating group: button A will turn ON picture A, button B will turn ON picture B, etc and each picture can be closed out. However, they need to be sorted in order of when they are turned ON. For example: button A, B, and C are clicked respectively, so the pictures are now in this order: A,B, and C. then Picture B is closed by pressing the X next to picture B. When button B is clicked, the picture is not in this order: A,C,B.

Is this possible?

Create a new data type for this.
For example you create one called ‘MyPicture’
The MyPicture type contains 2 important fields:

  • image (picture)
  • isOn (yes/no)
  • Name (text)

Now you create an RG of MyPictures that is sorted by ‘isOn’ as well as ‘Name’ or ‘Date’ or any other you require.
On clicking the button, the ‘isOn’ field gets toggled.
Every time you click something it will now get ordered and reordered correctly

This works, thank you!