【发布时间】:2014-10-22 10:32:17
【问题描述】:
我正在用 MVVM 结构编写我的应用程序。我在 GeoPortal.geox.components.MapToolbar 中有按钮作为项目。在我的视图(GeoPortal.view.map.Map)中,我使用此工具栏,并且工具栏的按钮在我的视图控制器(GeoPortal.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>'
}]
});
提前致谢。
【问题讨论】:
标签: javascript extjs mvvm extjs5