Hide Button If No Content In Database (Repeater)

Close… but i think he wants to show hide buttons, related to the given values in his DB. It was just an example → i used images instead of a buttons.

And yes that would be the simple one. This one is working on my example here…
https://www.media-junkie.com/repeater-queensmarket …for the images.

$w.onReady(function(){
   $w("#repeater1").onItemReady(($item, itemData, index)=>{
      // get the title property
      const title = itemData["title"];
      if (title) {
      // If title exists show the image
         $item("#image").show()
      }else{
         // If the title does not exist hide the image
         $item("#image").hide()
      }
   });
});

I changed my example —> to act with buttons instead of images…
Did not want to cause misunderstandings.


Now it works with buttons instead of images.
If there is no —> TITLE (number), then the correcponding button also will be hidden.

No ENTRY in DB: (item3 & item6)

No BUTTON in REPEATER: (item3 & item6)

In my example, the button-ID is —>“#title” and it is also the datafield-ID at once.

But the post-opener would need something like this one…

$w.onReady(function(){
    $w("#repeater1").onItemReady(($item, itemData, index)=>{
       const repeatedData1 = itemData[$item("#email").id]
       const repeatedData2 = itemData[$item("#socialMedia").id]
       const repeatedData3 = itemData[$item("#description").id]
 
       if(repeatedData1){$item("#email").show()}
       else{$item("#email").hide()}
 
       if(repeatedData2){$item("#socialMedia").show()}
       else{$item("#socialMedia").hide()}
 
       if(repeatedData3){$item("#description").show()}
       else{$item("#description").hide()}
    });
});

His setup was …

  1. Button-ID-1 —> “#email
  2. Button-ID-2 —> “#socialMedia
  3. Button-ID-3—> “#description
    and so on…

Of course the BUTTONS have to be INSIDE —> REPEATER !