Did you include the ‘!’ straight after the if on line 3 in your original testing with the linked forum post and with the linked tutorial as well?
The exclamation mark is in there for a reason and you can read about this on many other online pages…
https://stackoverflow.com/questions/8012003/what-is-an-exclamation-point-in-javascript
https://www.tutorialspoint.com/What-does-the-exclamation-mark-do-before-the-function-in-JavaScript
https://medium.com/better-programming/javascript-bang-bang-i-shot-you-down-use-of-double-bangs-in-javascript-7c9d94446054
Code from linked forum post
$w("#myRepeater").onItemReady( ($w, itemData, index) => {
if (! itemData.document) { // based on your "empty status" you need to change this line.
$w("#rankingsBtn").disable();
}
});
Code from linked tutorial
$w.onReady(() => {
$w("#myDataset").onReady(() => {
// Gets the current item properties and stores them in a variable called item
const item = $w("#myDataset").getCurrentItem();
// Checks if the current item has a value in the "video" field
if (!item.video) {
// Collapses the video player if there is no value for "video"
$w("#videoPlayer").collapse();
}
});
});
Line 6 checks to see if the item variable from the previous line includes the video field, which is the field in the collection that stores the video URL.
if (!item.video) {
If the current item’s video field is empty, then that field is not included in the object that was returned by getCurrentItem in the previous line.
So what part of the code here didn’t work for you?
$w.onReady(() => {
$w("#repeater1").onItemReady( ($w, itemData, index) => {
if (! itemData.immagini) {
$w("#gallery1").collapse();
}
});
});