如何在 webix 中将 obj 变量解析为 .show() 弹出窗口?

编程入门 行业动态 更新时间:2024-10-04 01:18:52

如何在 webix <a href=https://www.elefans.com/category/jswz/34/1771445.html style=中将 obj 变量解析为 .show() 弹出窗口?"/>

如何在 webix 中将 obj 变量解析为 .show() 弹出窗口?

我有这样的代码。

$$('TLVab').attachEvent("onAfterEditStop", function(state, editor, ignoreUpdate) {
        $$('deleteLTMPopup').show();//TODO parse state into the pop up      
  });

UI.deleteLTMPopup= {id:'deleteLTMPopup',view:'window',head:'D',modal:true,position:'center',resize:true,move:true,autowidth:true,body:
    {rows:[
      {id:'delLifeTimeMCN',template:'W'},
      {cols:[
        {},
        {view:'button',value:'Cancel',width:60,click:function(){ this.getTopParentView().hide()}},
        {id:'deleteLTMBtnOK',view:'button',value:'Delete',width:60,click:function(id){
          var that = this;
          myFunction(state);//TODO have to parse state
          that.getTopParentView().hide();
        }},
      ]},
    ]}
  };

如何将状态变量传递到弹出窗口?我的意思是有没有 .show(state) 之类的东西。我在我的代码中添加了 //TODO 内联注释。

回答如下:

对于 onAfterEditStop 事件,状态参数是一个具有新旧值的简单对象。

{ 值:任何,旧:任何}

不能扩展窗口视图的.show()方法,但是可以在调用.show()之前添加到.config对象中

见https://snippet.webix/o21oe6fq

onAfterEditStop 处理程序

$$('TLVab').attachEvent("onAfterEditStop",function(state, editor, ignoreUpdate) {
    const stateMsg = `changed from ${state.old} to ${state.value}`; 
    webix.message(stateMsg);
   

    const $popup = $$('deleteLTMPopup');
    $popup.config.stateRaw = state;  // add state object to config
    $popup.config.stateMsg = stateMsg;  // or whatever
    $popup.show();   
  });

对话框内的删除按钮可以抓取数据

  {id:'deleteLTMBtnOK',view:'button',value:'Delete',width:60,click:function(id){
      var that = this;
      const $popup = $$('deleteLTMPopup');
      webix.message('Again: ' + $popup.config.stateMsg);
      myFunction($popup.config.stateRaw); //TODO parse state
      that.getTopParentView().hide(); 
    }},

更多推荐

如何在 webix 中将 obj 变量解析为 .show() 弹出窗口?

本文发布于:2024-05-31 04:34:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1771277.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中将   变量   弹出窗口   如何在   obj

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!