问题
I'm showing repeater data from database.Data is showing perfectly in repeater .
Now I want to select Checkbox on one or more repeater but not working.
When I'm checked checkbox it should show "Air Jordan".But it is showing "Hydra".Also index value are not showing.
This is my code
export function checkbox1_change(event) {
// Add your code for this event here:
let myid=$w('#text32').text;
console.log(myid);
$w("#repeater2").onItemReady( ($item, itemData, index) => {
if ($w("#checkbox1").checked) {
console.log("index:"+index);
} else {
console.log("no Index");
}
} );
回答1:
You need to scope the clicked item like this
export function checkbox1_change(event) {
let $item = $w.at(event.context);
let myid = $item('#text32').text;
console.log(myid);
/*Checkbox*/
if($item("#checkbox1").checked){
console.log("index:"+index);
}else{
console.log("no Index");
}
}
Read more about scoping items here: https://www.wix.com/corvid/forum/tips-tutorials-examples/removal-of-the-w-parameter-from-event-handlers
来源:https://stackoverflow.com/questions/63394092/how-to-get-repeater-data-using-checkbox-in-wix