Enable/disable an item in UI when using a repeater and data set

Make sure your DEV MODE is turned on.
The following code will hide a button if there is no data applied to it for an item.

$w.onReady(() => {
    $w("#dynamicDataset").onReady(() => {
 // Gets the current item properties and stores them in a variable called item
 const item = $w("#dynamicDataset").getCurrentItem();
 // Checks if the current item has a value in the "button" field
 if (!item.button) {
 // Collapses the button if there is no value for "button"
            $w("#button123").collapse();
 }
 });
}); 
  • Change the ID for the “#dynamicDataset” to match the ID of your dataset.

  • Change the ID for the “if (!item.button)” to match the name of the dataset item

  • Change the ID for “#button123” to match the ID of your button.