Pass Dynamic Pro Gallery Dataset Item to Lightbox

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!

So no reply yet and Wix Customer Support says they do not support Wix Code Issues so post to the forum. I fully expect a Wix Code Support person to be quickly fielding these questions! If not, then a feel Wix will lose customers to Squarspace and Wordpress. You have a great product, but a broad range of customers need prompt answers! Thanks!

This would be great to know. I am trying to implement the exact thing.

Hi,
Is this code running?
console.log(“Gallery: item clicked!”);
Roi.

Yes, but the event.context in the next line of code: wixWindow.openLightbox(“PortfolioLightbox”, event.context ); does not contain the current row data I need.

Can you please share a link to your site and specify the name of the page so we can inspect?
Roi.