ExtJs5如何将浮动窗口作为项目添加到面板中
ExtJs5 How to add a floating window to a panel as an item?
我正在用MVVM结构编写应用程序。我在GeoPortal.geox.components.MapToolbar中有按钮作为项目。在我的视图(GeoPortal.view.map.map)中,我使用这个工具栏,工具栏的按钮在我的viewController(GeoPorter.view.map.MapController)中有操作。现在这个工具栏必须是浮动的,所以我把它放在一个浮动窗口中。但要访问按钮操作,该窗口必须是面板中的一项。
我试图在下面的代码中添加类似的项目,但我得到了这个错误:
TypeError: me.floatingItems is undefined
GeoPortal.view.map.map:
Ext.define("GeoPortal.view.map.Map",{
"extend": "GeoPortal.geox.components.Panel",
"controller": "map",
"viewModel": {
"type": "map"
},
"uses": ['GeoPortal.geox.components.MapToolbar',
'GeoPortal.geox.components.MapInfobar',
'GeoPortal.geox.components.Window'
],
initComponent: function () {
var win = Ext.create({
xtype: 'gxWindow',
id: 'mapToolbarWindow',
items: [{
xtype: 'gxMapToolbar'
}]
});
// FIX this
this.add(win);
this.callParent();
},
listeners : {
afterrender: {
fn: function () {
Ext.getCmp('mapToolbarWindow').show();
}
}
},
"region": 'center',
"collapsible": false,
"collapsed": false,
"xtype": "mapPanel",
items: [{
xtype: 'gxMapInfobar'
}, {
html: '<div id="map" class="map"></div>'
}]
});
提前谢谢。
您可以只存储对窗口this.win = Ext.create({ xtype: 'gxWindow' })
的引用。然后,您可以随时使用。如果您还需要对窗口中的面板进行引用,请将其传递到窗口配置:this.win = Ext.create({ xtype: 'gxWindow', panel: this })
中。
另外,你们应该注意,当面板被破坏时,你们应该破坏窗口,否则你们会有潜在的内存泄漏。
相关文章:
- 在Javascript中,当使用array.prush方法向列表中添加项目时,如何对其进行排序
- 在不向上滚动的情况下向列表框中添加项目
- 为图像滑块jquery添加项目符号功能
- 在Javascript中使用JQueryMobile向列表添加项目
- ng只重复添加项目一次
- jCarousel-动态添加项目
- 如何在控制器对添加项目执行操作后更新视图
- SharePoint 2013 在添加项目上运行 Javascript
- 从选择框中删除项目或向选择框添加项目
- 如何在 ExtJS5 中网格编辑器组合的当前记录中添加项目
- 反应多个组件添加项目
- 如何在KeystoneJS中以编程方式从页面添加项目
- 正在添加项目id's到js-if语句
- Rails-如何在添加项目时强制刷新页面
- AngularJS+simpleCart问题显示购物车内容,直到添加项目
- 按$index添加项目的角度过滤器
- OwlCarousel 2.0.0-beta.2.4-可以预先添加项目,但不能使用'add.wowl.carou
- 允许使用向asp.net mvc4模型添加项目
- 在Javascript中按下按钮时向列表中添加项目
- contentflow通过函数添加项目