Hi all - This topic has been talked about before, and lots of times, folks are referred to this page: https://www.wix.com/velo/forum/tips-tutorials-examples/connecting-your-database-to-lightboxes
I can get this code to work, but as a couple of commenters on this have said, when published, the contents appear in the correct order on the published page for just a couple of seconds, then the page refreshes and the item order goes wonky.
Here is the code snippet from that original post. Can anyone help diagnose the problem?
import wixData from ‘wix-data’ ;
import wixWindow from ‘wix-window’ ;
$w . onReady ( function (){
wixData . query ( “collectionName” )
. find ()
. then (( results ) => {
$w ( #repeater1
). data = results . items ;
})
. catch (( err ) => {
let errorMsg = err ;
});
$w ( #repeater1
). onItemReady (( $w, itemData ) => {
console . log ( itemData );
$w ( #button1
). label = itemData . title ;
$w ( #button1
). onClick (( event ) => {
wixWindow . openLightbox ( itemData . lightbox );
});
});
});
Thanks for any help!