Hello, I have a digital magazine (converted from PDF) using an online publishing service which shows items that a reader can click a URL ( example: https://www.website.com/4aad66c8-1807-42ae-b479-12a9796eee7x ) using the primary ID of the item in my collection.
I am only getting the primary Photo1 to display in my #gallery1 . But, my collection has 8 image fields: Photo1; Photo2; Photo3; Photo4; Photo5; Photo6; Photo7; Photo8
Below is code that is currently working on a Lightbox page, but I can’t modify to work on another Dynamic Page I have created. The field name for my primary ID is “ID”.
import wixWindow from ‘wix-window’ ;
import wixData from ‘wix-data’ ;
// …
$w.onReady( function () {
let receivedData = wixWindow.lightbox.getContext();
let listingId = receivedData.listingId;
$w( ‘#dataset1’ ).onReady(() => {
$w( "#dataset1" ).setFilter(wixData.filter()
.eq( "_id" , listingId)
)
.then(() => {
let item = $w( ‘#dataset1’ ).getCurrentItem();
let itemsForGallery = ;
for ( let i = 1 ; i < 9 ; i++) {
if (item[photo${i}
]) {
itemsForGallery.push({ src: item[photo${i}
] });
}
}
$w( “#gallery1” ).items = itemsForGallery;
$w( “#group1” ).show();
});
})
});