I am having a page to show a collection in a repeater.
I am having a bug when trying to play with the different items (indexed) of a radio button. As per the value, would like to hide or show a button. Actually this code only run for 3 rows of 15 rows.
Only the else condition code is executed. Why the if condition part is not run. See log belows
$w.onReady(function () { let x = buildReserv(dtDeb, nbSejour); $w("#repeater1").onItemReady(($item, itemData, index) => { // if ($item('#radioGroup1').value !== "Free") { if ($item('#radioGroup1').value !== "Free") { $item("#button1").show(); console.log("show=" + index + " "); } else { $item("#button1").hide(); console.log("hide=" + index + " "); } }); });
I was expecting seeing a line for every index from show=0 to show=11.
How can it be possible?
I found the solution. Need to use the foreachItem function:
$w.onReady(function () { $w("#period").onReady(() => {
$w("#repeater1").forEachItem(($item, itemData, index) => {
if ($item('#radioGroup1').value === "Free") {
$item("#button1").show();
console.log("show=" + index + " ");
} else {
$item("#button1").hide();
console.log("hide=" + index + " ");
}
});
});
Case close