Repeater.onItemReady not getting triggered

Hello,
I’m new to Wix Velo and I’m getting confused with repeaters.
What I’m trying to do is that I have a collection called TripCollection. Inside that collection I have multiple fields and I want to get one of those fields (a Media Gallery) do display those images inside a repeater. But when I pass the data to the repeater it’s like the onItemReady never gets triggered.
Any help would be appreciated.

import wixData from ‘wix-data’ ;

$w . onReady ( async function () {
$w ( ‘#repeaterHeroGalery’ ). onItemReady (( $item , itemData ) => {
console . log ( itemData );
$item ( ‘#textTest’ ). text = itemData . title ;
$item ( ‘#imageHeroThumbnail’ ). src = itemData . src ;
});

**await**  wixData . query ( 'TripCollection' ) 
    . eq ( '_id' ,  $w ( '#dynamicDataset' ). getCurrentItem (). _id ) 
    . find () 
    . then ( results  => { 
        **const**  galleryItems  =  results . items . map (( item ) =>  item . tripGallery ); 
        **let**  convertedItems ; 

        galleryItems . forEach ( element  => { 
            convertedItems  =  element . map (( item ) => ({ 
                _id :  item . slug , 
                title :  item . title , 
                src :  item . src 
            })); 
        }); 

        console . log ( convertedItems ); 
        $w ( '#repeaterHeroGalery' ). data  =  convertedItems ; 
    }); 

});

Try this one…

import wixData from 'wix-data';

$w.onReady(()=> {
    $w('#dynamicDataset').onReady(()=>{
        let curItem = $w('#dynamicDataset').getCurrentItem();
        let curID = curItem._id;

        wixData.query('TripCollection')
        .eq('_id', curID)
        .find()
        .then(results => {
            const galleryItems = results.items.map((item) => item.tripGallery);
            let convertedItems;

            galleryItems.forEach(element => {
                convertedItems = element.map((item) => ({
                    _id: item.slug,
                    title: item.title,
                    src: item.src
                }));
            });
            console.log(convertedItems);
            $w('#repeaterHeroGalery').data = convertedItems;
        });

        $w('#repeaterHeroGalery').onItemReady(($item, itemData) => {
            console.log(itemData);
            $item('#textTest').text = itemData.title;
            $item('#imageHeroThumbnail').src = itemData.src;
        });
    });
});

Hey, thank you for your help.
Same thing happens. It’s like the onItemReady never runs. I never see the console.log(itemData) inside the onItemReady.

Ah…I think it doesn’t like me using the gallerys slug as _id.

1 Like