Reputation: 5399
I'm trying to disable a button on window when this window pops up but whatever handlers I tried to apply, window in not poped up and just spits out that "undefined" staff to me. For example I tried:
window.onload = Ext.getCmp('buttonId').disable();
and it returns me this in console:
Uncaught TypeError: Cannot call method 'disable' of undefined
Thanks everyone in advance!
Upvotes: 0
Views: 331
Reputation: 7895
You probably do not have anid
set on the button...
Why don't you disable the button directly?
Ext.create('Ext.Button', {
text: 'Disabled button',
disabled:true
});
If you have an id
on there, it works:
Ext.create('Ext.Button', {
text: 'Dynamically disabled Button',
id:'dynamicBtn',
renderTo: Ext.getBody(),
handler: function() {
alert('You clicked the button!');
}
});
Ext.application({
name: 'MyApp',
launch: function () {
Ext.getCmp('dynamicBtn').disable();
},
});
Upvotes: 1