Hi all,
I'm relatively new to coding, but managed to find out that the following code makes it possible to collapse a strip when a database field (title) is empty.
$w.onReady(() => { $w("#dynamicDataset").onReady(() => { const item = $w("#dynamicDataset").getCurrentItem(); if (!item.title) { $w("#columnStrip90").collapse(); } }); });
I was hoping to finetune this code; When another database field called "tags" (and which is connected to selection tags input) DOES NOT contain a tag called "hotel", I want a strip to be collapsed as well.
Does anybody now how to write the code for this? I appreciate your help!
@Stefan Assuming your field type is Tags, this code will work. When accessing the field value, Wix returns an array. The Javascript function indexOf() is searching that array for "Hotels". If it doesn't find it (returns -1), then the columnStrip will collapse.
if (item.tags.indexOf("Hotels") === -1){ $w("#columnStrip90").collapse(); }