[英]EXTJS Display a View within Ext.window.Window
I am using version 4.2. 我正在使用4.2版。
I currently have a view which extends a panel. 我目前有一个扩展面板的视图。 On this panel there is a button which displays a modal window.
在此面板上,有一个显示模式窗口的按钮。 The controller code when the button is clicked is below (which I pulled from the extjs docs ):
单击按钮时的控制器代码如下(我从extjs docs提取的代码):
displaySearch : function(btn) {
var panel = Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
layout: 'fit',
modal : true,
items: {
...
}
}).show();
}
I want a View I already have created to be rendered INSIDE the modal window I just defined. 我希望在我刚刚定义的模态窗口内渲染已经创建的视图。
How do I do that? 我怎么做?
If you have defined an alias (xtype) for that view, let's say it is 'myview', then you just add it to items like this: 如果您已经为该视图定义了别名(xtype),那么说它是“ myview”,那么只需将其添加到以下项目中:
var panel = Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
autoShow:true,
layout: 'fit',
modal : true,
items: [{
xtype:'myview'
}]
});
Also, you don't need to call show()
on the created window, it is enough if you configure autoShow:true
. 另外,您无需在创建的窗口上调用
show()
,如果您配置了autoShow:true
,就足够了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.