Strange expand / collapse issue in repeater

Hi,
this happens because all the buttons points to the same element.
I find a solution for your problem, and maybe it’s not the best, but it works.

I made a repeater with a collapsed text. so when the button is pressed the text would expand/collapse just for this box.

export function button1_click(event) {
let clickedItemData = $w(“#dataset1”).getCurrentItem();

$w("#repeater1").onItemReady( ($w, itemData, index) => { 

if (event.context.itemId==itemData[‘_id’]){
if ($w(‘#text1’).collapsed){
// expand what you want here.
$w(‘#text1’).expand();
}
else {
//collapse what you want here
$w(‘#text1’).collapse();
}
}

}) 

the bad thing in my code is checking all the items to find the pressed item.

I hope this would help you.
good luck.