Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Readonly property on Field SenchaTouch

Hi i've been looking for the readOnly property for field in secnhatouch but haven't found it... can some one assist me on this matter

{
                 xtype: 'textfield',
                 name: 'ReferenceNumber',
                 readOnly:true,
                 label: 'Reference'
}
like image 724
Necronet Avatar asked May 29 '11 19:05

Necronet


2 Answers

I ran into the same problem with readOnly: true not working - I was able to fix it by adding an afterrender listener:

{
    xtype: 'textfield',
    name: 'ReferenceNumber',
    label: 'Reference',
    listeners: {
        afterrender: function(ele) {
            ele.fieldEl.dom.readOnly = true;
        }
    }
}
like image 181
Nick Avatar answered Nov 15 '22 08:11

Nick


I think you want the disabled field

{
    xtype: 'textfield',
    name: 'ReferenceNumber',
    **disabled**: true,
    value: '12312421',
    label: 'Reference'
}

I overload the 'disabledCls' because it grey's out the label more than i want.

like image 31
Adam Marshall Avatar answered Nov 15 '22 10:11

Adam Marshall