Extjs 将参数传递给显示窗口 [英] Extjs pass in parameters to window on show

查看:19
本文介绍了Extjs 将参数传递给显示窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在调用 window.show() 时将参数传递给我的窗口.

I want to pass parameters to my window when I call window.show().

我在我的窗口中为 show 方法添加了一个侦听器,但它将参数显示为 [Object, object].

I added in a listener to my window for the show method but it's displaying the parameter as [Object, object].

 #window call
 var test = 'hi';
 tstWin.show(test);

 #listener
  listeners : {             
    'show' : function(test){
        alert(test.value);
     }   
  }

推荐答案

在您的事件处理程序中的参数将与您放入 show() 方法中的参数不同.事实上,他们彼此没有任何关系.

In your event handler arguments will not be the same as you put into show() method. In fact they have nothing to do with each other.

阅读:http://docs.sencha.com/ext-js/4-0/#!/api/Ext.AbstractComponent-event-show

显示事件处理程序将在第一个参数中接收对对象的引用.

Show event handler will receive in the first argument reference to the object.

更新:

你可以这样做:

win = Ext.create(...); // Create your window object here
win.myExtraParams = { a: 0, b: 1, c: 2}; // Add additional stuff
win.on('show', function(win) {
   console.log(win.myExtraParams.a, win.myExtraParams.b, win.myExtraParams.c);
});

win.show();

这篇关于Extjs 将参数传递给显示窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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