In your excellent video explaining how to populate a repeater from a static variable array Erdam clearly states that he has created subsequent videos explaining how to populate a repeater directly from a Wix query which actually creates an array in its results.
Have searched but cannot find this video so please can you point me in the right direction?
Many thanks in anticipation
Cliff
Do you really need a VIDEO for that?
Ok, let's go!!!!! --> we will do it also without any VIDEO.
Let's imagine you have opened your Wix-Editor (doesn't matter on wich one you are working).
You also have activated the DEVELOPER-MODE, to be able to write some CODINGS on your Wix-Website.
Here we go... we want to do what exactly? Populating a --> REPEATER???
Ok, time to do some codings....
import wixData from 'wix-data';
5. Ready the page...
$w.onReady(()=>{............................});
6. Writing the query-function....
function getData() { return wixData.query('myDB') .find() .then((results)=> { if(results.items.length > 0) { console.log(results.items[0]); return results; } else { // handle case where no matching items found } }).catch((err)=> {console.log(err);}); }
7. Calling our generated function inside the onReady-Block, to get data from DB.
import wixData from 'wix-data'; $w.onReady(async()=>{console.log('Page ready...); let myData = await getData(); console.log('Data: ', myData); }); function getData() { return wixData.query('myDB') .find() .then((results)=> { if(results.items.length > 0) { console.log(results.items[0]); return results; } else { // handle case where no matching items found } }).catch((err)=> {console.log(err);}); }
8. Once we got our data from DB and saved inside a VARIABLE (myData), now we
are able to push it for example into our REPEATER.
import wixData from 'wix-data'; $w.onReady(async()=>{console.log('Page ready...); let myData = await getData(); console.log('Data: ', myData); $w("#myRepeater").data = myData; }); function getData() { return wixData.query('myDB') .find() .then((results)=> { if(results.items.length > 0) { console.log(results.items[0]); return results; } else { // handle case where no matching items found } }).catch((err)=> {console.log(err);}); }
9. The rest of what and how to do, you will learn while reading the following post..
!!! GOOD-LUCK & HAPPY CODING !!!