How to set a full array value to array variable?

I have a server connect with multiple records. This array is repeated in the front end. And on click of the repeat element, a sub array of the repeated element must be set to the array variable for further updates. How can I update it.

Example: wappler_array = []

Can you show us the front end Wappler elements? (the right side panel)

I want to set the highlighted to a wappler array item.
I have used repeat feature to complete this feature, but a easier approach would be better.

The way that I do it is via a custom js function

If you don’t have one already create a js file and call it in your layout page.

<script src="/js/functions.js" defer=""></script>

inside this file add the following function:

function setArray(dmxArray, inValues) {
    newDmxArray = dmx.parse(dmxArray); // get the original array structure
    newDmxArray.items = []; // empty the array
    newDmxArray.count = 0; // reset the couunt
    for (item of inValues) { // loop through your items and add them to the new array
        newDmxArray.items.push(item)
    }
    getLen = newDmxArray.items.length; // update the count
    newDmxArray.count = getLen;
    dmx.requestUpdate() // tell the front end to rerender
}

from your app page
define an array

On the button you want to set the array add a flow (this can also be called from a root flow)

In the flow call the setArray function using Run JavaScript

The first argument is the array you want to update
The second argument is your inbound array

Any questions please ask