How to enable button in extjs?

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

I have a submit button that is disabled by default.

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

I want to enable a button based on a specific 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 the option above 2. Which did not work for me. Can anyone help me out?

+7
source share
1 answer

Use this:

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

When you use Ext.getCmp (), it gives you a component that uses several component methods. If you use Ext.get (), it gives you an element with several functions for modifying the dom element. Thus, it is always best to test in the firebug console for any of them to know what methods exist.

 console.log(Ext.getCmp('submit')); console.log(Ext.get('submit')); 
+20
source

All Articles