Forum Academy Marketplace Showcase Pricing Features

Button press on all items of a repeating group

Hey everyone,

Is there a way to autopress all buttons of a repeating group?

I am displaying data on a Scatter Graph, and I want to change the color and size of the point depending on the values of an item of a list.

The only way which I found of doing this is by adding a button to a repeating group and once pressing it displaying the Point in the Scatter graph. And it works well (see the image below).
image

What I want to achieve though, is that all the buttons will be pressed on the repeating group when the page loads, so the graph can get populated with data points automatically, without me having to go and press them all 1 by 1. Is there any way that that is possible in Bubble?

Cheers,
Admir

Instead of clicking all the buttons, can you just do whatever action is run per button click on the whole repeating group list on page load workflow?

1 Like

hey @williamtisdale I’ve tried that, it works, but the issue is that the points in the graph will take the same colour and size, whereas if I click on them one by one, I’ve set up conditions to change the size and colour of the point in the graph according to some values that each item on the repeating group is.

Can you not assign those values in the workflow? If you can’t get a work around using the Page Load Workflow then you can use javascript to achieve your goal. You will need the free ‘Toolbox’ plugin. Then on Page is Loaded workflow you can use the action Run Javascript. Here you will be able to reference each button. But first you will have to give the Button an ID attribute which can be found at the bottom of the element’s property editor. For eaxample if you gave the button the id of ‘example’, then your javascript would look like this.
var elements = document.querySelectorAll('#example'); elements.forEach((element) => {element.click()});

Here is an example where each button in the repeating group changes the text to ‘You clicked this button’ once the javascript runs on page load:

Here is the editor to check out the workflow and ID placement:

Here is the plugin you will need:

1 Like

Ah thanks a lot, works perectly with the Javascript code!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.