PDA

View Full Version : ReadonlyField



henryli86
31 Oct 2007, 11:19 AM
shown as plain text. its value can be set as a normal form field. no submit.


Ext.namespace("Ext.ux");

Ext.ux.ReadonlyField = Ext.extend(Ext.form.Field, {
defaultAutoCreate : {tag: "div", style:'padding-bottom:0; padding-top:3px;'},

initValue : function() {
if (this.value !== undefined) {
this.setValue(this.value);
}
},

setValue: function(v) {
return this.el.dom.innerHTML = (v === null || v === undefined ? '' : v);
}
});
Ext.reg('readonlyfield', Ext.ux.ReadonlyField);