[solved] Hide a entire strip based on an empty column from Data Set on a dynamic page

I have a dynamic page that displays text, image, and video.

I would like to hide the entire strip that contains the video,
if there is no video url(youtube) on my data set.

why is below code not working? somebody please help :sob:

$w.onReady(function () {
    $w("#dynamicDataset").onReady(() => {
        var item = $w("#dynamicDataset").getCurrentItem();
            if (currentItem.video) {
            $w("#columnStrip1").expand();
        } else {
            $w("#columnStrip1").collapse();
        }
    });
});
$w.onReady(()=>{console.log("Page is ready!");
    $w("#dynamicDataset").onReady(()=>{console.log("Dynamic-Dataset is ready!");
        var currentItem = $w("#dynamicDataset").getCurrentItem(); console.log("Current-Item: ", currentItem);
            if (currentItem.video) {console.log("IF-Statement running!"), $w("#columnStrip1").expand();}
            else {console.log("ELSE-Statement running!"), $w("#columnStrip1").collapse();        }
    });
});
2 Likes

@russian-dima
Thank you soooo much!!! It works perfect :smiley::man_bowing: you saved my life :sob::sob::sob::sob:

Can I ask you a favor… if you dont mind,
Could you please help me to add one more field to collapse the strip like bellow?
(I would like to hide the strip if both videos are empty.)

if video and video2 fields are empty, columnStip1 will expand
and if video and video2 fields are NOT empty, columnStip1 will collapse

@dahlia907

$w.onReady(()=>{
   $w("#dynamicDataset").onReady(async()=>{
      var currentItem = $w("#dynamicDataset").getCurrentItem(); 
      if (currentItem.video && currentItem.video2) {
         $w("#columnStrip1").expand();
         $w("#columnStrip1").show('slide', {duration500});
         
      }
      else {
         await $w("#columnStrip1").hide('slide', {duration500});
         $w("#columnStrip1").collapse();
      }
   });
});

With some additional stuff for the —> Cat! Let’s dance!

1 Like

Hi Lamy,

This question has been asked hundreds if not thousands, you should have searched the forum first.