Disable specific links on certain items in dynamic repeater

I just answered a similar logic question on a different post.

This is a sample of what the code would generally look like on that page with the repeater.

Let’s say you have a boolean column in your database called isSold. You would check to see if the boolean is true, if yes, then disable the item / button in that 1 repeater item. If you want all the buttons in the repeater to become disabled then you would change the $item to $w.

$w.onReady(function () {
  // Dataset Connected to Repeater
  $w("#dataset1").onReady(() => {
    $w("#repeater").forEachItem(($item, itemData, index) => {
      //Repeated Text Element
      if (itemData.isSold) {
        $item("#button1").disable();
      }
    });
  });
});

Now let’s say you have the word “Sold” in a text column instead of a boolean column. (Boolean columns are easier.). Then you would nest another if statement like this …

(The code is now looking for the specific word “Sold” with a capital S and no spaces before or after any of the other letters.

$w.onReady(function () {
  // Dataset Connected to Repeater
  $w("#dataset1").onReady(() => {
    $w("#repeater").forEachItem(($item, itemData, index) => {
      //Repeated Text Element
      if (itemData.isSold) {
let yesSold = itemData.isSOld;
        if (yesSold === "Sold") {
        $item("#text1").collapse();
      }
      }
    });
  });
});

If you need further clarification or private training, I am available for hire. Just reach out via email!

Nayeli
#codequeen
#totallycodable

nayeli@codequeen.us