In the above image, I want to get the value of the product name when clicking the cancel button and store it on variable.
Does anyone has any idea how to do it?
$w.onReady(() => {
$w("#repeater1").onItemReady(($item, itemData, index) => {
$item("#button5").onClick(event => {
let productName = itemData.name; //use the field key as stored in your collection
})
})
})
(fixed a typo)
[UPDATED]
But I will only get first data with this code.
In repeaters we have many list.
Suppose I click the button on the third list, I need the values from the third list of that repeater.
How to accomplish that??
@dhamaalyash you’ll get the data of the clicked item.
@jonatandor35 When I click on the button of third list I should get the data from third data,
but instead I only get data from first list
export function button5_click(event) {
$w(“#repeater1”).onItemReady(($item, itemData, index) => {
let productname = itemData.productName;
})
}
@dhamaalyash that’s not the code I wrote.
Have a look at my code. I’ve made it clearer
@jonatandor35 Great It worked
Thank You
@dhamaalyash You’re welcome
@yash thakur
export function button5_click(event) { $w("#repeater1").onItemReady(($item, itemData, index) => {
$item('#id_of_button_in_repeater').onClick((event)=>{
let productname = $item('#productName').text;
console.log(productname)
})
}) }
Please try this one hope it will work