Repeater and dataset

Hi,
I have a repeater set up with a dataset. All is working well.

In my dataset, I want to add a bool value. If this value is true, I would like for a textfield in my repeater to be hidden.

Ex:
Dataset fields: name (text), IsAvailable (bool), phone(number)
Repeater: should display the phone number unless IsAvailable is false.

I’m having a hard time understanding the relationship between the repeater and the dataset. When I use Wix Code, how do I access the dataset and how do I know with which element of the repeater it is associated?

I looked at the forItems function, but didn’t understand how to make the link with the dataset powering the repeater.

Thanks!

1 Like

Hey,
you may try to do something in this direction:

#text1 - is your text field
Make it “Hidden on Load” form Properties panel
IsAvailable - is your boolean (capitalisation should be same as in you field key in collection)
show text, if boolean is true:

$w.onReady(function () {
$w('#repeater1').onItemReady(myItemReady);

 function myItemReady($w, itemData, index) {
 if (itemData.IsAvailable) {
            $w("#text1").show();
        }
    }

});
1 Like

Ill Respond to this Gregory as it works perfectly

Thanks you very much

1 Like