How to disable inputEl of a textbox in ExtJS?

I am working with ExtJS and I have a textbox component. I would like to disable only inputEl

the textbox component (not the label).

If I use the setDisabled()

textbox method it disables inputEl

but also the label.

I also used the method setReadOnly()

, but it is not grayed out inputEl

, only set as ReadOnly

.

Is there a way to disable just inputEl

the textbox component?

Thank you for your help.

+3


source to share


2 answers


You will need to set your own class to disabledCls

.ux-item-disabled .x-form-field, .ux-item-disabled .x-form-display-field, .ux-item-disabled .x-form-trigger {
   filter: alpha(opacity=30);
   opacity: .3;
}

      



see JSFiddle

+2


source


I have another answer to Sencha forum (I thought it might be interesting to also post here)   Solution

Use the setOpacity method



Ext.onReady(function () {
var panel =Ext.create('Ext.form.Panel', {
    title: 'Basic Form',
    renderTo: Ext.getBody(),
    bodyPadding: 5,
    width: 350,
    items: [{
        xtype: 'textfield',
        fieldLabel: 'Field',
        name: 'theField',
      disabled: true
    }]        
});

 panel.down('[xtype=textfield]').labelEl.setOpacity(1); });

      

0


source







All Articles