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.
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
}