【发布时间】:2014-06-02 06:05:45
【问题描述】:
我有一个带有左侧导航菜单的主应用程序。我的 Main.js 控制器处理添加了 Tab 的 treepanelselect 事件:
onTreepanelSelect: function (selModel, record, index, options) {
var mainPanel = Ext.ComponentQuery.query('mainpanel')[0];
var newTab = mainPanel.items.findBy(
function (tab) {
return tab.title === record.raw.text;
});
if (!newTab) {
newTab = mainPanel.add({
xtype: record.raw.class_name, // this is my View widget name
closable: true,
iconCls: "key",
title: record.raw.text
});
}
mainPanel.setActiveTab(newTab);
},
两个导航菜单项是:
- 员工 (
controller.Employee) - 目录 (
controller.Catalog)
controller.Catalog 是我用于管理我的目录的控制器,并且与 controller.Employee(2 个不同的模块)100% 分开
这是我的controller.Catalog:
refs: [
{
ref: 'grid',
selector: '#gridCatalog'
}],
init: function (application) {
this.control({
'grid': {
selectionchange: this.gridSelectionChange
}
});
},
gridSelectionChange: function (model, records) {
console.log("Catalog Row Selected");
},
所以 view.Catalogs 有一个 gridCatalog 和 selectionchange 我在我的控制台中得到:Catalog Row Selected。
另一边,这是我的controller.Employee:
refs: [
{
ref: 'grid',
selector: '#gridEmployee'
}
],
init: function (application) {
this.control(
{
'grid': {
itemdblclick: this.gridDoubleClick
}
});
},
gridDoubleClick: function (dv, record, item, index, e) {
// nothing here for the moment.
}
好吧,这就是魔鬼出现的地方。
当我运行我的应用程序时,然后我单击我的导航项“Employee”并创建了我的选项卡,其中包含其中的视图。直到这里我们都很好。
但是....当我单击gridEmployee 的其中一行时,猜猜是什么?我进入控制台:Catalog Row Selected.
所以,出于某种原因,controller.Catalog 正在监听我的gridEmployee...我的controller.Employee 中没有selectionchange 事件处理程序。这些文件甚至位于我的“app”文件夹中的单独模块文件夹中。
关于我做错了什么的任何线索?这让我头疼:(
【问题讨论】:
-
你能在fiddle.sencha.com创建一个例子吗?
标签: extjs extjs4 extjs4.1 extjs4.2