PDA

View Full Version : enable() does not work for button



sandhya.agarwal
17 Aug 2009, 10:03 PM
Hello,

I have a button which is initially disabled with "disabled:true" attribute set. Now, I am trying to enable the button based on certain action by doing a Ext.getCmp(<button-id>).enable(). But this does not enable my button. Anything more I need to do ? Please let me know.

Thanks,
Sandhya

evant
17 Aug 2009, 10:05 PM
You're probably doing something else wrong, this works.



Ext.onReady(function(){
var b = new Ext.Button({
text: 'Foo',
disabled: true,
renderTo: document.body
});
b.enable();
});

sandhya.agarwal
17 Aug 2009, 10:10 PM
The same thing works for other buttons in my app. The only difference I find is that this button is rendered to a div by using button.render(). Could that be a reason ?

sandhya.agarwal
17 Aug 2009, 10:36 PM
Ok..there was a problem with the code..since I had not written the initial code, I could not spot it easily. Two buttons were given the same Id due to which this was failing. Thanks Evan for your help.