Hi. I have a dynamic Wix Pro Gallery that is setup and working correctly with a dataset (1 row per gallery item). The Gallery is also setup with additional filter buttons and this all works correctly.
I want to open a lightbox and pass the context object to display more information…essentially treat the lightbox as a template with fields to display based on the passed row data (context object).
$w.onReady(function () {
console.log("--- Portfolio page ready");
updateNav("#buttonAd"); // custom filter buttons
$w("#datasetPortfolio").onReady( () => {
console.log("--- datasetPortfolio onReady");
currentItem = $w("#datasetPortfolio").getCurrentItem();
currentIndex = $w("#datasetPortfolio").getCurrentItemIndex();
$w("#portfolioGallery").onItemClicked( (event, $w) => {
console.log("Gallery: item clicked!");
console.log(" item title = " + event.item.title);
wixWindow.openLightbox("PortfolioLightbox", event.context);
} );
});
});
The above code works up until I call the lightbox.
The lightbox appears, but the “event.context” is null. The problem I have is that the context is not updated. How do I get the related row data object of the selected gallery image item? I’ve searched the forums and have not found an answer.
I’ve also tried using the variable currentItem, but that only uses the first item in the filtered gallery items.
I’m sure someone must have come across this issue, but I can’t find the answer in the forum.
And while we’re at it I would like to request dynamic lightboxes, so they can appear in link area for datasets and elements!
Thanks!