Hello guys, i need a help with writting a code for a Dynamic Lightbox, i have a button on a repeater that has few elements on it.
So i want the the lightbox to get the same data from the element on the repeater, for example Booking website, 3 available rooms on the repeater, so i want when i client clicks on Book, the Lightbox will have the room’s data to fill in.
I will be very glad.
Thanks you for the reply, but in my case it is a bit different, because in the Lightbox pops up more information about the room than on the repeater, so what i need is actually that the data element with all the data fields in the collection ( a Line in the collection ) to be transferred and then the lightbox fills up the info from the dataset.
Is it possible?
@lukachina70 You can try passing the repeater itemData in the openLightbox function, or you can simply pass the itemData._id and run a query in the lightbox’s onReady.
Either way should work.
@skmedia Hi David, Thank you very much.
But i am not a code guy, and that is too complicated for me.
Could you help me with some code?
@lukachina70 You would trigger the lightbox like this:
$w('#repeater1').onItemReady(($item, itemData, index) => {
$item('#button1').onClick(() => {
wixWindow.openLightbox('lightbox_name', itemData);
});
});
And then use getContext to retrieve the passed data inside the lightbox. Make sure you read that documentation I linked.