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 Roo.form.DisplayText
13 * @extends Roo.form.Field
16 * Creates a new Display text fiedl
17 * @param {Object} config Configuration options
19 Roo.form.DisplayText = function(config){
20 Roo.form.DisplayText.superclass.constructor.call(this, config);
24 Roo.extend(Roo.form.DisplayText, Roo.form.Field, {
26 * @cfg {Number} width - mostly ignored
30 * @cfg {Number} height - used to restrict height of image..
34 * @cfg {String} focusClass The CSS class to use when the checkbox receives focus (defaults to undefined)
36 focusClass : undefined,
38 * @cfg {String} fieldClass The default CSS class for the checkbox (defaults to "x-form-field")
40 fieldClass: 'x-form-field',
43 * @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
44 * {tag: "input", type: "checkbox", autocomplete: "off"})
47 defaultAutoCreate : { tag: 'input', type: 'hidden', autocomplete: 'off'},
50 * @cfg {String} inputValue The value that should go into the generated input element's value attribute
53 onResize : function(){
54 Roo.form.Field.superclass.onResize.apply(this, arguments);
58 initEvents : function(){
59 // Roo.form.Checkbox.superclass.initEvents.call(this);
65 getResizeEl : function(){
69 getPositionEl : function(){
74 onRender : function(ct, position){
75 Roo.form.DisplayText.superclass.onRender.call(this, ct, position);
76 //if(this.inputValue !== undefined){
78 this.style = this.style || '';
79 var style = this.style;
82 Roo.form.DisplayImage.superclass.onRender.call(this, ct, position);
83 this.wrap = this.el.wrap({cls: 'x-menu-check-item'});
84 this.viewEl = this.wrap.createChild({ tag: 'div'});
87 this.viewEl.applyStyles(style);
89 this.viewEl.setStyle('padding', '2px');
91 this.viewEl.setWidth(this.width);
94 this.viewEl.setHeight(this.height);
96 this.setValue(this.value);
104 initValue : Ext.emptyFn,
109 onClick : function(){
114 * Sets the checked state of the checkbox.
115 * @param {Boolean/String} checked True, 'true', '1', or 'on' to check the checkbox, any other value will uncheck it.
117 setValue : function(v){
119 var html = this.renderer ? this.renderer(v) : String.format('{0}', v);
121 this.viewEl.dom.innerHTML = html;
122 Roo.form.DisplayText.superclass.setValue.call(this, v);