Alternating Colours on Repeating Group Rows

Hello

Could someone please assist me in how I can get the rows on my repeating group to be alternating colours.
I looked at Cell Number and but I cannot workout how modulo works and how I do this for the whole row rather individual cells.

Thank you

2 Likes

We have this https://bubble.io/reference#Data.Messages.number.modulo . If you come with the right formula you should be able to do this for the row

2 Likes

I looked at that already

  1. not sure how to use that in a formula, an example would be great.
  2. The only way I can get the repeating groups cell in the conditional bit is if I select one of the elements in the group like a textbox, but that only sets the background of that bit not the entire row
1 Like

This is how I do it.

I set the repeating group background as “None”.
Then I create a group (not repeating) in the repeating group´s cell and set a background on that group instead. In that group you then put all the content you want on that “row/box”.
There´s many good reasons to do it like this instead of just setting elements, like text, directly in the reaping group´s cell. This way you can control what you want to show in the list much more.
One being the color of the background of the “lines”.

So let´s say you set the standard background of the group (within the repeating group) to white.
Then you set a condition on the group as on the screenshot below.
This way every second row will be white and the others grey (in this case). Since evert second cell this statement will be true and in the others not.

I think and hope this answers both your questions?!

Good luck!

24 Likes

Thats is brilliant Thank you!
I will have a go at that today :smile:

1 Like

Worked a treat…thank you

2 Likes

Sweet!

1 Like

Is there a problem with adding all the RG’s elements in a group instead of just on the RG level. I’m trying to sort an RG on date (or any column for that matter) and it wont do it so I wonder if it could be something to do with the fact that they sit in a group…

What do you mean by “sit in a group?”

as @Kackur mentioned, he adds a group to the RG first, then add all the elements you want in the RG to the group.

This way, the individual elements aren’t ‘current cell’s xxx’ but ‘parent group’s xxx’

OK, never mind. Forgot i had a condition in place where the sorting wasnt set. I have a ‘show all button’ that shows all of the things of all users in the RG as opposed to a filter to just show all things for 1 client. Stupid…

Oh, yeah, got it. I do that all over the place in my app and don’t have any issues sorting. What is happening when you try?

Sorry to have bothered you with my mistake :weary:

1 Like

No worries! I was genuinely curious :stuck_out_tongue:

Hi @Kackur could you help me? I have follow your instruction, but it doesnt work. I set the RG background to none and set the group (within the RG) background color, then use ‘modulo’ in conditional…but when i preview this, the RG being no color, i think it’s because the RG background setting, when i change the RG background color to flat, then the preview still follow the color that I set on th RG…is there something wrong or i miss something from your instruction ?

Q2

2 Likes

I just love the answer you received. I’m trying to figure out the same thing.

You need to put something to colorize in the cell. Use a shape or a group (better, IMO). So here’s your group inside the cell:

It’s set to be white and flat color by default, but then the condition will change the even ones to blue and looks like this in run mode:

Now, if the default for your Colorizer group is some other style (like “None”), you’ll also have to change it’s style of course, not just it’s BG color. Like:

If you wanna color change the odd ones instead, you would do “is not” 0.

3 Likes

Thank you!

1 Like