I have 2 boxes one on top of the other in a container.
I'd like the top box to disappear when my Database is empty and the box below goes up ... can someone help me with the code, I struggle ...
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
Did you originally use the code from here.
https://support.wix.com/en/article/corvid-tutorial-hiding-a-video-player-when-there-is-no-video-to-play
As it should work if done correctly.
So, the news code, thanks to you works…
But… there is a but… the element is hiding everywhere on the dynamic page even if the field has data… I think I work with the good ID name… but I do something wrong but I don't know what… it's frustrating…
$w.onReady(() => { $w("#dynamicDatasetFICTION").onReady(() => { const item = $w("#dynamicDatasetFICTION").getCurrentItem().venteDistribution; if (!item.venteDistribution) { $w("#boxDISTRIBUTEUR").collapse(); } else { console.log("Expand"); $w("#boxDISTRIBUTEUR").expand(); } }); });
Plus, this line is not getting a field as it is getting all items.
const item = $w("#dynamicDatasetFICTION").getCurrentItem(); // Checks if the current item has a value in the "venteDistribution" field
https://www.wix.com/corvid/reference/wix-dataset.DynamicDataset.html#getCurrentItem
To get a field only then change your code to suit.
$w("#dataset1").getCurrentItem().field;
Just remember to change field to the field that you want to use.
#dynamicDatasetFICTION
Is this the actual ID name of your dataset on your page?
Hover over the dataset icon on your page to view the ID name on the top left.
Or open the properties panel for this dataset and you will see the ID name at the top.
https://www.wix.com/corvid/forum/community-discussion/how-to-hide-elements-based-off-other-empty-elements
So, I tried this… but know the box is hidden even if the item is full…
Someone has an idea?
$w.onReady(() => { $w("#dynamicDatasetFICTION").onReady(() => { const item = $w("#dynamicDatasetFICTION").getCurrentItem(); if (!item.venteDistribution) { $w("#boxDISTRIBUTEUR").collapse(); } }); });
Just do what it says in the Forum Guidelines and use the search function in this forum and you would have found an old forum post on this...
https://www.wix.com/corvid/forum/community-discussion/hide-a-repeater-if-dataset-is-empty
https://www.wix.com/corvid/forum/community-discussion/hide-an-empty-field
https://www.wix.com/corvid/forum/community-discussion/hide-image-text-on-dynamic-page-if-there-is-non-in-database