4 * Copyright(c) 2006-2007, Ext JS, LLC.
6 * Originally Released Under LGPL - original licence link has changed is not relivant.
9 * <script type="text/javascript">
12 * @class Ext.form.DisplayField
13 * @extends Ext.form.Field
14 * A generic Field to display non-editable data.
16 * Creates a new Display Field item.
17 * @param {Object} config Configuration options
19 Ext.form.DisplayText = function(config){
20 Ext.form.DisplayText.superclass.constructor.call(this, config);
24 Ext.extend(Ext.form.DisplayText, Ext.form.Field, {
26 * @cfg {String} focusClass The CSS class to use when the checkbox receives focus (defaults to undefined)
28 focusClass : undefined,
30 * @cfg {String} fieldClass The default CSS class for the checkbox (defaults to "x-form-field")
32 fieldClass: 'x-form-field',
35 * @cfg {Function} renderer The renderer for the field (so you can reformat output). should return raw HTML
40 * @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
41 * {tag: "input", type: "checkbox", autocomplete: "off"})
44 defaultAutoCreate : { tag: 'input', type: 'hidden', autocomplete: 'off'},
46 onResize : function(){
47 Ext.form.Field.superclass.onResize.apply(this, arguments);
51 initEvents : function(){
52 // Ext.form.Checkbox.superclass.initEvents.call(this);
58 getResizeEl : function(){
62 getPositionEl : function(){
67 onRender : function(ct, position){
68 Ext.form.DisplayText.superclass.onRender.call(this, ct, position);
69 //if(this.inputValue !== undefined){
72 this.wrap = this.el.wrap();
73 this.viewEl = this.wrap.createChild({ tag: 'div'});
76 this.viewEl.applyStyles(this.bodyStyle);
78 //this.viewEl.setStyle('padding', '2px');
80 this.setValue(this.value);
85 initValue : Ext.emptyFn,
95 * Sets the checked state of the checkbox.
96 * @param {Boolean/String} checked True, 'true', '1', or 'on' to check the checkbox, any other value will uncheck it.
98 setValue : function(v){
100 var html = this.renderer ? this.renderer(v) : String.format('{0}', v);
101 this.viewEl.dom.innerHTML = html;
102 Roo.form.DisplayText.superclass.setValue.call(this, v);