Hi everyone,
I’m trying to hide a gallery when it’s not valued in the dataset. Below is the code that still does not work. Can you please help me?
Thanks in advance, as always
$w(“#DDTS1”).onReady( function () {
var pageGallery = $w(‘#DDTS1’).getCurrentItem();
if (pageGallery[“galleryProduct”] === undefined) {
$w(‘#gallery1’).collapse();
$w(‘#gallery1’).hide();
}
});
As it is a bit complicated to understand your collection structure without seeing it, I assume ta you have a field key called “galleryProduct” that contains the images.
If this is the case, then in order to call to this specific field you’ll need to have something like this instead of putting it into square brackets:
pageGallery.galleryProduct === undefined
Hi Angelina,
I tried your suggestion, but it doesn’t work. It behaves like other attempts that I have made or it always hides everything from me. Forget my code …
In practice I need to hide the gallery when there are no elements in the collection record. I’ve tried everything, but I can’t … or it always hides me or leaves me always visible.
I tried with undefined, null, === 0,
Can you Help Me?