OK. I tried to do it and was successful in hiding three buttons if data in one of the database field is empty. But I also want to adjust the elements below the hidden elements to move upwards if the buttons are collapsed. The code is shown below.
As far as I read, the collapsed element does not take any space and the elements below the collapsed element are moved upwards. This is not happening on my site. An empty space is left where the three buttons were supposed to be.
Another thing is that I have to keep the properties of buttons at “Collapsed on load”. Otherwise the thing is not working.
$w.onReady( function () {
//Collapse and Show Series Buttons
// get the current item from the dataset
const currentItem = $w(“#dynamicDataset”).getCurrentItem();
// get the current Series Text
const series = currentItem.series;
if (series. null ) {
$w(‘#Series’).collapse()
$w(‘#Booknum’).collapse()
$w(‘#Booknum2’).collapse()
} else {
$w(‘#Series’).expand()
$w(‘#Booknum’).expand()
$w(‘#Booknum2’).expand()
}
});