Can anyone help me out?
I have a database collection for displaying profiles…with 4 image fields (with png icons). Each profile will have a variation of the 4 images.
I have the images inside a container inside the repeater item with a 1x4 grid displaying like this.
I’m trying to simply expand and collapse the emblem images based off of whether there’s an image in the database field.
I’m new to learning code/let alone velo. But from forums and scouring and looking at the API references this is the code I’ve come up with. I’m not getting any errors, but it’s not working.
Seems like it should be simple. What am I missing?
Any help would be appreciated. I’d like to understand this, because it’s a pretty basic feature/thing I’ll need to do on lots of websites I’m designing.
Much appreciated in advance.
$w.onReady(() => {
$w("#HubProfilesDataset").onReady(() => {
// Gets the current item properties and stores them in a variable called item
const item = $w("#HubProfilesDataset").getCurrentItem();
// Checks if the current item has a value in the "certification1" field
if (item.certification1 === undefined) {
// Collapses or hides the image if there is no value for "certification1"
$w("#cert1").collapse();
} else {
$w("#cert1").expand();}
}
)});