i am assuming that the repeater would do the job for filling up the rest of my page with the contents that i have in my database? or am i wrong? this is one of the code i have tested that didnt work that i think is closest to what i am trying to achieve.
import wixData from 'wix-data';
$w.onReady(function () {
wixData.get('animals', 'animalAge') //collection, field name
.then((result) => {
$w('#datePicker1').value = result; //yes, a datepicker and not a text element. i got it disabled so it cannot be modified.
}); });
can anyone give me some tips or examples??
Hi 🖐
When querying, set the query result to be the repeater's data, then use the repeater's onItemReady() function to populate the data.
wixData.query("animals").find().then( (result) => { $w('#repeater1').data = result.items; }).catch( (err) => { console.error(err); }); $w('#repeater1').onItemReady( ($item, data) => { $item('datePicker1').value = data.animalAge; })
This will populate each and every animal's age on the date-picker, just make sure you're placing this code inside the page's onReady() function.
Hope that helped~!
Ahmad