I have written the following code, and it works as expected. Or at least it outputs to the console exactly what I want. It enters the conditional as I would expect. But it doesn’t actually expand or collapse the text elements. Why is this? I have tried everything but can not find any solution. Thank you in advance! Ryan
$w.onReady(() => {
$w("#text54").expand();
$w("#itemsDataset").onReady(() => {
let previousCategory = "test";
$w("#repeater1").onItemReady(($item, itemData, index) => {
let theItem = itemData.shortDescription;
let desctiptionShow = theItem.substr(0, 200);
$item("#description").text = desctiptionShow + " ...";
let currentCategory = itemData.category;
console.log(previousCategory.toString() + " previous");
console.log(currentCategory);
if (previousCategory === currentCategory) {
$w("#headingText").collapse(); //this doesnt work!!
console.log("collapse");
} else {
$w("#headingText").expand(); //this doesnt work!!
console.log("expand");
}
console.log();
previousCategory = currentCategory;
});
});
});
And yes, I am sure that element ID is the correct name, “headingText” in this case.