无法在ExtJS 3.4上添加菜单项

时间:2013-09-18 12:10:18

标签: extjs extjs3

我正在尝试以下代码在运行时添加菜单项但我无法使其工作,ExtJS文档仅包含样本以创建整个菜单以及菜单项。 非常感谢任何帮助。

var menuItem = Ext.create('Ext.menu.Item', { text: 'menu item'});

错误:

TypeError: b[e] is not a constructor
Ext.ComponentMgr.create()ext.axd?v=31893 (line 7)
()debugg...al code (line 2)


...;if(a.getMonth()==G.getMonth()&&a.getFullYear()==G.getFullYear()){this.cells.rem...

1 个答案:

答案 0 :(得分:2)

您正在使用Ext4的语法Ext.create。在Ext3中,该函数将config对象作为其第一个参数,并期望在其中找到xtype(参见doc)。

E.g。

var menuItem = Ext.create({xtype: 'menuitem', text: 'menu item'});

但您也可以使用new运算符:

var menuItem = new Ext.menu.Item({text: 'menu item'});
相关问题