How to get repeater data using checkbox in WIX?

倖福魔咒の 提交于 2021-01-28 20:43:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!