1 //<script type="text/javascript">
3 * @class Ext.form.Checkbox
4 * @extends Ext.form.Field
5 * Single checkbox field. Can be used as a direct replacement for traditional checkbox fields.
7 * Creates a new Checkbox
8 * @param {Object} config Configuration options
10 Ext.form.FormGrid = function(config){
11 Ext.form.FormGrid.superclass.constructor.call(this, config);
15 Ext.extend(Ext.form.FormGrid, Ext.form.Field, {
17 * @cfg {Number} width - mostly ignored
21 * @cfg {Number} height - used to restrict height of image..
25 * @cfg {String} grid The embeded grid...
29 * @cfg {String} focusClass The CSS class to use when the checkbox receives focus (defaults to undefined)
31 focusClass : undefined,
33 * @cfg {String} fieldClass The default CSS class for the checkbox (defaults to "x-form-field")
35 fieldClass: 'x-form-field',
37 * @cfg {Boolean} checked True if the the checkbox should render already checked (defaults to false)
41 * @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
42 * {tag: "input", type: "checkbox", autocomplete: "off"})
44 // defaultAutoCreate : { tag: 'div' },
45 defaultAutoCreate : { tag: 'input', type: 'hidden', autocomplete: 'off'},
47 * @cfg {String} addTitle Text to include for adding a title.
51 onResize : function(){
52 Ext.form.Field.superclass.onResize.apply(this, arguments);
56 initEvents : function(){
57 // Ext.form.Checkbox.superclass.initEvents.call(this);
63 getResizeEl : function(){
67 getPositionEl : function(){
72 onRender : function(ct, position){
74 this.style = this.style || '';
75 var style = this.style;
78 Ext.form.DisplayImage.superclass.onRender.call(this, ct, position);
79 this.wrap = this.el.wrap({cls: 'x-menu-check-item '}); // not sure why ive done thsi...
80 this.viewEl = this.wrap.createChild({ tag: 'div' });
82 this.viewEl.applyStyles(style);
85 this.viewEl.setWidth(this.width);
88 this.viewEl.setHeight(this.height);
90 //if(this.inputValue !== undefined){
91 //this.setValue(this.value);
94 this.grid = new Roo.grid.EditorGrid(this.viewEl, this.grid);
96 var layout = Roo.BorderLayout.create({
98 margins:{left:3,top:3,right:3,bottom:3},
99 panels: [new Roo.GridPanel(grid)]
110 initValue : Ext.emptyFn,
113 * Returns the checked state of the checkbox.
114 * @return {Boolean} True if checked, else false
118 * Sets the value of the item.
119 * @param {Boolean/String} checked True, 'true', '1', or 'on' to check the checkbox, any other value will uncheck it.
121 setValue : function(v){
124 Roo.form.FormGrid.superclass.setValue.call(this, v);