Extjs Menu Check Items - How to call?
문제
I am using Extjs 4.1 as part of my project. So every Extjs component in view.js , I could call it using Ext.getCmp and use it anywhere in my code.
My problem is with Menu Check Items.. I couldn't find a way to call each item and check for selection in anywhere but view.js !! I need those items to be checked in another part of my project but I have no idea how to do that !
My handler:
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!');
}
}
As you see above, if I want to send each menucheckitem to another js file and check for selection.. How I can do that ?
해결책
Using Ext.getCmp is not considered a best practice. You can use ComponentQuery class to target your desired component. See other SO questions about getCmp.
제휴하지 않습니다 StackOverflow