repeater button.hide() not working

Hi I’m working on a item configurator which will have a few segments / blocks and a few options for every segment / block. Some options cannot be combined so I used .disabled() on buttons if this was the case, but I’m now looking to .hide() the button instead of disabling it.

function disabler(repeaterName, secondaryIndexArray, buttonName) {
 //let enabler_array = 
 $w(repeaterName).onItemReady( ($item, itemData, index) => {
 
 let n = secondaryIndexArray.includes(index)
 
 if (n === true) { 
 let repeatedElement = $item(buttonName);
 $item(buttonName).hide() // this is not working
 $w(buttonName).hide() // not wroking either
 //repeatedElement.disable() // this is working
 checkForIncompatibleDekor(secondaryIndexArray)
        }
 else {
 console.log("didn't satisfy condition, going on...")
        }
 
    })
 //enabler()
}

Am I perhaps using the hide() method incorrectly?

is this the code from your page?

what are you passing as value to the button name?
where and how are u using disabler function?

the way you can use the disabler as u made it is like this.

disabler(“#yourRepeaterName”, secondaryIndexArray,“#yourButtonName )

Kind regards,
Kristof.

yes this is my code from a configurator page.

the values I’m passing are correct, this is working with disabled() method, but if it helps you with anything, I’m passing "# selectDekorButton " which is inside "# dekorSelectionRepeater "

The use of disable function is depicted in my code snippet, it disables a button inside the repeater

And yes, that is how I am using the disabler :smiley: I made it

But as I said in the question, after a bit of testing I have made a decision that if a option isn’t available I want it to be NOT visible, instead of just disabled.

I have went through the documentation, $w(buttonName) is depreciated but $item(buttonName) should be working, hence I created this post.

The code and values I’m passing are correct since once again, this code is working with the disable() method

This is my use case, the first time I try using hide() method on my repeater buttons which doesn’t do anything. The second time I use disable method() which works perfectly as intended