【问题标题】:How to get repeater data using checkbox in WIX?如何使用 WIX 中的复选框获取中继器数据?
【发布时间】:2020-08-13 11:22:32
【问题描述】:

我正在显示来自数据库的转发器数据。数据在转发器中完美显示。

现在我想在一个或多个中继器上选择复选框但不工作。

当我选中复选框时,它应该显示“Air Jordan”。但它显示的是“Hydra”。索引值也没有显示。

这是我的代码

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

   } );

【问题讨论】:

    标签: javascript database checkbox repeater velo


    【解决方案1】:

    您需要像这样对单击的项目进行范围

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

    在此处阅读有关范围项目的更多信息:https://www.wix.com/corvid/forum/tips-tutorials-examples/removal-of-the-w-parameter-from-event-handlers

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-08
      • 2019-03-23
      • 2018-03-14
      • 1970-01-01
      相关资源
      最近更新 更多