How to fire a server connect that is within a repeat group?

Forget that. I thought you were trying to reference from inside the array.

If it’s a button outside the repeat you need to loop. Try with a flow.

Got it, thank you @sid and @JonL - no idea how to do that yet :sweat_smile: something new to learn - but at least I know with your guidance that is the way to do it. Thank you!

I’ve had a crack, got somewhere by repeating on the original data source, and using a condition in the flow to match the data source row unique ID against the arr.1 items (the id is stored here when the checkbox is clicked).

But I still get stuck on trying to fire the SC.

If either of you don’t mind - where should I start in terms of what I should loop through - so I can work from there. Am I correct in assuming I should loop through the same data source that the repeat uses?

Then what I need to find a way to do is to input the correct $index number into the .items when I try to run that specific SC? Is that the general idea I should be aiming for?

Yup.

Thank you!

Do you need to run specific server actions inside the rows or all of them from the outside?

I run them individually with a button click, and then I’m creating a ‘all’ button which I want to run them all on that page (15)

So for an ALL button, you can try something like this in JS:

for(i=0;i<dmx.app.data.content.sc1.data.repeat1.length;i++){
    $("#buttonInRepeat" + i).click();
}

Here, sc1.data.repeat1 is the source for repeat. And buttonInRepeat is the unique ID of each of the buttons which can be set in the repeat as:
dmx-bind:id="buttonInRepeat{{$index}}"

Each unique click should load its own personal server connect as per on:click settings.

I can’t believe I am suggesting this as I hate filtering at client end but could you not perform one server connect to download ALL the data and use .filter() within the repeat to filter the data to show only that relevant to that element. For smaller numbers one action + filter may be as efficient as 15 separate API calls.
At 15 elements the processing overhead on the browser should not be too detrimental on the performance
(sorry not 100% what your use case is)

Thank you for this @sid! I'm going to try and implement this today. I'm a little stuck however, as I'm new to JS. Would I include this on the page within script tags? And then use a static event for the ALL button to fire this JS? or is this the code for the static event on the ALL button?

You will have to create a function.
And then you can call that function using regular dynamic click’s flow.