本文介绍了Extjs将参数传递给窗口显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在一个监听器中添加了我的窗口来显示show方法,但是它显示参数为[Object,object]。
#window调用
var test ='嗨'
tstWin.show(test);
#listener
listeners:{
'show':function(test){
alert(test.value);
}
}
解决方案
您的事件处理程序参数将与您在 show()
方法中的相同。其实他们没有任何关系。
阅读:
显示事件处理程序将在对象的第一个参数引用中收到。
更新:
你可以这样做:
win = Ext.create(...); //在这里创建你的窗口对象
win.myExtraParams = {a:0,b:1,c:2}; //添加其他东西
win.on('show',function(win){
console.log(win.myExtraParams.a,win.myExtraParams.b,win.myExtraParams.c);
});
win.show();
I want to pass parameters to my window when I call window.show().
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);
}
}
解决方案
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.
Read this: 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.
Update:
You can do something like that:
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将参数传递给窗口显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!