我正在使用 Extjs 4.1 作为我项目的一部分。所以视图中的每个 Extjs 组件.js ,我可以使用 Ext.getCmp 调用它,并在代码中的任何位置使用它。
我的问题是菜单检查项。我找不到一种方法来调用每个项目并在除查看之外的任何地方检查选择.js!!我需要在项目的另一部分检查这些项目,但我不知道该怎么做!
我的处理程序:
myHandler: function (menucheckitem, checked, opts) {
switch (menucheckitem.getId ()) {
// Here handles the first
case 'first':
if (checked) {
console.log ('First checked!');
goToFunction ();
}
break;
// Here handles the second
case 'second':
if (checked) {
console.log ('Second checked!');
goToFunction ();
}
break;
default:
console.log ('Whatever!');
}
}
正如您在上面看到的,如果我想将每个菜单检查项发送到另一个 js 文件并检查选择。我该怎么做?
使用 Ext.getCmp 不被认为是最佳实践。可以使用 ComponentQuery 类来定位所需的组件。请参阅有关getCmp的其他SO问题。
up() 和 down() 与 Ext.getCmp()