Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to enable button in extjs?

Tags:

extjs

extjs4

I am new to ExtJs(using EXT js 4 ), I am trying out simple code.

I have a submit button which is set disabled by default

buttons: [{
    text: 'Submit',
    id:'submit',
    disabled:true  
}]

I want to enable the button based on certain conditon.Something like

if (validation_status== "success") {
    //Enable the submit button
    //Ext.get('submit').dom.disabled = false; -- Not working
    //Ext.get('submit').enable(); -- Not working            
}

I tried above 2 option. Which did not worked for me. Can anyone help me out?

like image 302
PPB Avatar asked Jun 24 '11 10:06

PPB


1 Answers

Use this:

Ext.getCmp('submit').enable();

When you use Ext.getCmp(), it gives you the component which has a number of component methods to use. If you use Ext.get(), it gives you the element with a number of dom element modification functions. So, its always better to test in firebug console for any of these to know what methods are there.

console.log(Ext.getCmp('submit'));

console.log(Ext.get('submit'));
like image 192
Swar Avatar answered Oct 20 '22 17:10

Swar