What you need to do is go through all the repeater items (which has a bunch of elements in it) and test if the datafield is set them true or false, then show()/hide() the element ($item) in the repeater.
In your [ $w ( “#dataset1” ). onReady (()=>{] section, you will need to add a foreachItem code section. This will go through each repeater section after the data is ready.
I use the code below to set my repeater elements. I put this code in my dataset.onReady() section.
On my repeater, I have a Booking Button. This button is shown if the “textBookEnableFlag” field (which is also on the repeater) is set to ‘true’. I hide this field on the repeater, since I don’t want to display it, I just need it to be there, so I can check its value. Then based on that value, I either show or hide the Booking Button.
I also format a text cost field by preappending a ‘$’ and postappending a ‘.00’.
Here is the code snippet where I iterate (walk through) each repeater section.
$w("#repeater1").forEachItem( ($item, itemData, index ) => {
// format the cost field
$item("#textCost").text = '$' + $item("#textCost").text + '.00';
// check if we are hiding the book button
if ($item("#textBookEnableFlag").text === 'false') {
$item("#buttonBook").hide();
}
else { $item("#buttonBook").show();
}
$item("#buttonBook").label = $item("#textBookButtonLabel").text;
});