如何使用WIX中的复选框获取转发器数据? [英] How to get repeater data using checkbox in WIX?

查看:78
本文介绍了如何使用WIX中的复选框获取转发器数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在显示数据库中的转发器数据.数据在转发器中完美显示.

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.

当我选中复选框时,它应该显示"Air Jordan".但是它显示"Hydra".也不会显示索引值.

When I'm checked checkbox it should show "Air Jordan".But it is showing "Hydra".Also index value are not showing.

这是我的代码

   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");
   }   

   } );

推荐答案

您需要确定单击项的范围,

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

这篇关于如何使用WIX中的复选框获取转发器数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆