Onready code for repeater

Hi All,

I am stuck… So I have the below code on my page to be able to have addresses listed on my dynamic page hyperlinked and takes you to google maps with the location auto populated.

Now here is where I am stuck… It works fantastically, but… only for the first address listed in my database column I have the button connected/linked too… I need it to “map” each individual address that is populated on my repeater (not just the first one)… When I click another address it maps the first address…

Help!!

Hey
Within your dataset1 onReady you need to loop though all items in the repeater. The way you do it now you only set the first item.

$w("#myRepeater").onItemReady( ($w, itemData, index) => { 
 $w("#button5").link = prefix + itemData.address;
 } );

This way when dataset is ready and repeater item is onItemReady it will loop though all your items and inside this function you can modify and alter content of each item which is stored in the itemData.address. Do not use getCurrentItem this way but do it the way I show you. It works! Good luck and happy coding.

1 Like

thank you andreas… When I enter this code and change out the repeater to reflect my # I get the caution symbol saying index is never used… Is this something to worry on?

Also not sure why now line 7 is saying invalid symbol… Each line is closed or am i missing something

You are missing one closure so try adding another }); to close the onReady itself.

1 Like