This code is right out of the documentation and I'm using it pretty much as is, except for some name changes. Getting errors that say that onItemReady does not exist on myRepeater. Same with data property on the repeater. How do I set the repeater's data to my collection?
I imagine it would look something like
$w("#myRepeater").data = bikeData;
but I'm using a collection so I tried $w("myRepeater").data = "Artists"; gives me the error that data does not exist on myRepeater. The repeater element is a box.
import wixData from 'wix-data';
$w.onReady(function () {
$w("#myRepeater").onItemReady( ($item, itemData, index) => {
$item("#bookTitle").text = itemData.title;
$item("#bookSubtitle").text = itemData.subtitle;
$item("#bookCover").src = itemData.pic;
} );
wixData.query("Books")
.find()
.then( (results) => {
$w("#myRepeater").data = results.items;
} );
} );
Thank You, Amy
Try this:
import wixData from 'wix-data'; $w.onReady(function () { wixData.query("Books") .find() .then( (results) => { $w("#myRepeater").data = results.items; $w("#myRepeater").forEachItem(($item, itemData, index) => { $item('#bookTitle').text = itemData.title; //etc, etc... }); } ); } );