Hiding / Collapsing Repeater Item if Data Field is Empty OR Boolean Field is True

I am trying to hide a Gallery element in my Repeater which is linked to a dataset if the field in that dataset is empty. I don’t see any solutions for this scenario, so as a workaround, I’m trying to now hide the Gallery element based on whether another field in my dataset is True (boolan field “imageUploaded”) so that I can manually mark the field as True if I want the Gallery element to show.

Here is the code I’ve got:

$w.onReady(()=>{

$w(‘#dataset1’).onReady(()=>{

$w(‘#repeater1’).onItemReady(($item,itemData)=>{

if(itemData.imageUploaded===true){

$item(‘#gallery1’).show();

}

else{

$item(‘#gallery1’).hide();

}

});

});

});

For future reference, format your code like so:
```js
your code here
```

As for your code:

  • Remove the dataset onready - it sets your repeater’s onitemready filter multiple times
  • You said “if data field is empty OR if boolean is true”, but:
    • You’re showing when it’s true, not hiding
    • You’re not checking the data field

Other than a description of your code, I don’t see a question - are asking how to check whether the gallery field is empty?

Refactored, your code would look like so:

$w('#repeater1').onItemReady(($item, itemData) => {
    if (itemData.imageUploaded) $item('#gallery1').show() 
    else $item('#gallery1').hide()
})