Hi and thank you in advance to anyone who is kind enough to help a newbie coder. I have modified a code I found to connect a database with individual lightboxes and after a little tweaking it is working great, yay! ...but
The issue I am having is that the code is affecting the sort setting I have setup with the database which is a simple A-Z sort when displaying the database. When the live page loads it most often flips the database sort from A-Z to Z-A when it is displayed live. Sometimes it doesn't but most often it does. For reference, at the moment it should begin with the name Heather Burton.
Below is a link to the live site page I am working on along with the code I am using.
import wixData from 'wix-data';
import wixWindow from 'wix-window'; $w.onReady(function () { wixData.query("Agents") .find() .then((results) => { $w(`#repeater1`).data = results.items; }) .catch((err) => { let errorMsg = err; }); $w(`#repeater1`).onItemReady(($w, itemData) => {console.log(); $w(`#button1`).label = itemData.contact; $w(`#button1`).onClick((event)=>{ wixWindow.openLightbox(itemData.lightbox); }); }); });
Hello, I'm new to coding, and I'm trying to do the same thing here. I'm not sure which parts of the code reference your personal datasets and lightboxes and which are just pure code. Also, do you just post this on the page with the repeater or do you need to put it in the lightbox and the repeater pages? Using the dataset system
It is not clear why you run a direct query (for the Agents collection) if you already have the repeater connected to a dataset.