At first sight, adding event handling for repeated items looks easy. You just handling events of repeated items inside Repeater loop methods there you have all needed data and scope with selector $item()
.
$w("#repeater").onItemReady(($item, itemData, index) => {
// it look easy
$item("#repeatedButton").onClick((event) => {
// we have all we need
console.log(
$item("#repeatedContainer"),
itemData,
index,
);
});
});
What’s wrong with this approach?
At first sight, adding event handling for repeated items looks easy. You just handling events of repeated items inside Repeater loop methods there you have all needed data and scope with selector $item().
JavaScript
x
12
1
$w(“#repeater”).onItemReady(($item, itemData, index) => {
2
// it look easy
3
$item(“#repeatedButton”).onClick((event) => {
4
// we have all we need
5
console.log(
6
$item(“#repeatedContainer”),
7
itemData,
8
index,
9
);
10
});
11
});
12
What’s wrong with this approach? […]