Conditional hide/collapse of button inside repeater

Hello! I’m trying to collapse a button inside of an $item of a repeater if a field of the itemData matches a specific value.
unfortunately, collapse or hide the button for every element of the repeater and not just for the one with the specified field.
I’ve already tried this solution: https://www.wix.com/velo/forum/community-discussion/hide-repeater-contents-based-on-data?origin=auto_suggest
but it didn’t work even if my case is pretty similar to this one, my code is the following:


export function Repeater_itemReady($item, itemData, index) {
 let  i=0
 $item("#Img").src = itemData.src
//console.log(i++)

 if (itemData._id === "selectedField"){ $item("#button").expand(); console.log('selectedField'); $item("#button").label='selectedField'}
 else {$item("#button").expand() ; console.log(i++,'otherfield')}

}

The funny thing is that the label changes and console.log shows everything(also the ‘selectedField’ one) but only the button doesn’t expand/collapse.
Thanks

  1. Perhaps the button has a wrong —> ID ?
  2. Perhaps your button is also hidden and has to be shown?
  3. Sure that your button is inside repeater?

What do you get for —> console.log(itemData . _id) ?
Can you show a console-log-screen ?

Hello russian-dima!
sorry silly of me, this one works but after the else goes a collapse, not an expand😅. Hope I didn’t bother you and thanks a lot !

Damn! Also did not see it xDDDDDD :sweat_smile: