Pushing dynamic data to the HTML (Repeating Group)?

Hey guys,

So I want to push the dynamic data of each cell of RG with HTML/CSS element, to achieve different gradients for each Group in the Repeating Group:

image

The HTML file is nested into the Repeating Group cell. But the issue is that it does not change all the backgrounds dynamically - it changes them all to a single color:

image

Where am I making a mistake? I would very much appreciate someone helping me solve this issue as I’ve been searching over the internet but didn’t find something that could help me…

Best regards,
T

Hello!

You shouldn’t need an HTML element to achieve this functionality - you can set the group’s background style to gradient in the bubble inspector, and then enter dynamic colors into the starting color and ending color fields.

Hey @sam.morgan , thanks for your reply.

The thing is that the basic Bubble gradient editor does not provide with a bit “complex” design features, so I would need to implement it this way (with CSS) to get the results.

Do you have an idea on how could I achieve it this way with HTML/CSS?

Unfortunately, I don’t - custom code is outside of the scope of our support, but hopefully some other users on the forum here have answers for that solution!

Hey @petrovic.teodor :wave:

Do you have the ID Attributes enabled?

Hey @J805 , yes of course - and it’s linked to the group that should be colored gradient. :slight_smile: It is expected that each group in repeating group is colored differently, but it colors them all the same (purple like on the example)

@petrovic.teodor Ok good. :white_check_mark:

Next, what is the name of your attribute in your code above?

It would be helpful if you share a screenshot of the element’s ID attribute too.

1 Like

Hello @J805 ,

So the ID that I’m using as shown in the screenshot is #RoleGradient.

Attached is the screenshot of how it is applied to the group which belongs to the repeating group:
image

I can tell it is successfully applied because it successfully changes the group’s gradient. But the dynamic part is what is not working (it’s not pulling each cell’s dynamic data and changing each cell to a correct gradient color).

Ok. Cool. :white_check_mark:

Next, for the ID Attribute. At the end use dynamic data and do current cells index. No spaces, underscores or dashes should be ok.

Do the same thing in the code.

At the moment, all the items inside the repeating group have the same ID. That’s why they are all the same color. By adding current cells index, each will have a unique id attribute instead.

Let me know if that works. :blush:

@j805 www.NoCodeMinute.com

For All Your No-Code Education Needs:

2 Likes

@J805 , it worked, and I’ve unlocked a new skill when it comes to Bubble. Thanks a lot! :slight_smile:

1 Like

Awesome. Glad it helped. :blush:

Hey @J805 , although it works, for some reason when a User change the color in the app (picks a color from dropdown he wants), it doesn’t change the color immediately - it changes when the page is refreshed (F5). Do you know what could be a cause for this and how to fix it?

To be honest that’s very strange. When an user changes color it shows like this:
image

But after F5 refresh, it changes correctly:
image

Hmm. Good question. I’m not sure if it has something to do with the custom code or not. You can try refreshing the repeating group instead of the page in a workflow to see if that makes a difference. :man_shrugging:

1 Like

Hey @J805 how would you refresh the RG or the group? I was trying to find such a feature in the workflows but didn’t find it - I guess there’s some workaround? :thinking:

Maybe try “display list in a repeating group”? See if that refreshes it. :man_shrugging:

I love the bubble forums - no matter what I’m stuck on, I can find a solution here, or someone helpful to explain what I’m doing wrong!