PDA

View Full Version : ReadOnly fields over ExtJS form



Pravin.Pawar
24 Oct 2012, 1:32 AM
Hi,

I have show ready only fields (these fields are calculated on the fly) at certain places over the dialog window in ExtJS 4.1. I'm using following code somehow it is NOT matching with expected behaviour. I coded as -


var form = Ext.widget('form', {
layout: {
type: 'vbox',
align: 'stretch'
},
---------------------
---------------------

xtype: 'textfield',
name: 'rfc',
fieldLabel: 'RFC',
labelWidth: 185
}, {
xtype: 'field',
name: 'cirtduration',
fieldLabel: 'CIRT Duration (Min)',
value: '12.75',
labelWidth: 185
}
, {
xtype: 'textfield',
name: 'businessimpactduration',
fieldLabel: 'Business Impact Duration (Min)',
disabled: true,
labelWidth: 185
}

Please let me know how should I show "CIRT Duration" in read only mode. Even label is okay for me.

danguba
24 Oct 2012, 3:14 AM
Something like this?
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Display

scottmartin
24 Oct 2012, 4:34 AM
If you are looking for the field to look like it is disabled, but still submitted like readonly, then please see the following:
http://www.sencha.com/forum/showthread.php?234614



xtype: 'textfield',
name: 'name',
readOnly: true,
fieldLabel: 'Name',
cls: 'x-item-disabled', // simulate disabled; submitted
value: 'readonly'


Scott.

Pravin.Pawar
24 Oct 2012, 9:16 PM
Thank you... I can use xtype: displayfield -

items: [{
xtype: 'displayfield',
fieldLabel: 'Home',
name: 'home_score',
value: '10'
}

vijay30487
27 Jul 2015, 3:18 PM
@ scottmartin: Thanks for sharing, thats what I want - Vijay

scottmartin
28 Jul 2015, 6:10 AM
No problem, glad it helped.