X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=Roo%2Fform%2FLayout.js;fp=Roo%2Fform%2FLayout.js;h=e9dbb44dfe539a795d149c5f2247d54f51415a77;hp=bea152474fbb72a1e1ba1c519b3152189772a4da;hb=1cebb6d16aa3004663d63bdbc4d604fbcd8f2f5d;hpb=10db261e7d6b23c055f07797e9afef70ffed408a diff --git a/Roo/form/Layout.js b/Roo/form/Layout.js index bea152474f..e9dbb44dfe 100644 --- a/Roo/form/Layout.js +++ b/Roo/form/Layout.js @@ -40,7 +40,7 @@ Roo.extend(Roo.form.Layout, Roo.Component, { * a function which returns such a specification. */ /** - * @cfg {String} labelAlign + * @cfg {String} labelAlign (left|top|right) * Valid values are "left," "top" and "right" (defaults to "left") */ /** @@ -160,155 +160,3 @@ Roo.extend(Roo.form.Layout, Roo.Component, { } }); -/** - * @class Roo.form.Column - * @extends Roo.form.Layout - * @children Roo.form.Row Roo.form.Field Roo.Button Roo.form.TextItem Roo.form.FieldSet - * Creates a column container for layout and rendering of fields in an {@link Roo.form.Form}. - * @constructor - * @param {Object} config Configuration options - */ -Roo.form.Column = function(config){ - Roo.form.Column.superclass.constructor.call(this, config); -}; - -Roo.extend(Roo.form.Column, Roo.form.Layout, { - /** - * @cfg {Number/String} width - * The fixed width of the column in pixels or CSS value (defaults to "auto") - */ - /** - * @cfg {String/Object} autoCreate - * A DomHelper element spec used to autocreate the column (defaults to {tag: 'div', cls: 'x-form-ct x-form-column'}) - */ - - // private - defaultAutoCreate : {tag: 'div', cls: 'x-form-ct x-form-column'}, - - // private - onRender : function(ct, position){ - Roo.form.Column.superclass.onRender.call(this, ct, position); - if(this.width){ - this.el.setWidth(this.width); - } - } -}); - - -/** - * @class Roo.form.Row - * @extends Roo.form.Layout - * @children Roo.form.Column Roo.form.Row Roo.form.Field Roo.Button Roo.form.TextItem Roo.form.FieldSet - * Creates a row container for layout and rendering of fields in an {@link Roo.form.Form}. - * @constructor - * @param {Object} config Configuration options - */ - - -Roo.form.Row = function(config){ - Roo.form.Row.superclass.constructor.call(this, config); -}; - -Roo.extend(Roo.form.Row, Roo.form.Layout, { - /** - * @cfg {Number/String} width - * The fixed width of the column in pixels or CSS value (defaults to "auto") - */ - /** - * @cfg {Number/String} height - * The fixed height of the column in pixels or CSS value (defaults to "auto") - */ - defaultAutoCreate : {tag: 'div', cls: 'x-form-ct x-form-row'}, - - padWidth : 20, - // private - onRender : function(ct, position){ - //console.log('row render'); - if(!this.rowTpl){ - var t = new Roo.Template( - '
', - '', - '
', - '
', - '
' - ); - t.disableFormats = true; - t.compile(); - Roo.form.Layout.prototype.rowTpl = t; - } - this.fieldTpl = this.rowTpl; - - //console.log('lw' + this.labelWidth +', la:' + this.labelAlign); - var labelWidth = 100; - - if ((this.labelAlign != 'top')) { - if (typeof this.labelWidth == 'number') { - labelWidth = this.labelWidth - } - this.padWidth = 20 + labelWidth; - - } - - Roo.form.Column.superclass.onRender.call(this, ct, position); - if(this.width){ - this.el.setWidth(this.width); - } - if(this.height){ - this.el.setHeight(this.height); - } - }, - - // private - renderField : function(f){ - f.fieldEl = this.fieldTpl.append(this.el, [ - f.id, f.fieldLabel, - f.labelStyle||this.labelStyle||'', - this.elementStyle||'', - typeof f.labelSeparator == 'undefined' ? this.labelSeparator : f.labelSeparator, - f.itemCls||this.itemCls||'', - f.width ? f.width + this.padWidth : 160 + this.padWidth - ],true); - } -}); - - -/** - * @class Roo.form.FieldSet - * @extends Roo.form.Layout - * @children Roo.form.Column Roo.form.Row Roo.form.Field Roo.Button Roo.form.TextItem - * Creates a fieldset container for layout and rendering of fields in an {@link Roo.form.Form}. - * @constructor - * @param {Object} config Configuration options - */ -Roo.form.FieldSet = function(config){ - Roo.form.FieldSet.superclass.constructor.call(this, config); -}; - -Roo.extend(Roo.form.FieldSet, Roo.form.Layout, { - /** - * @cfg {String} legend - * The text to display as the legend for the FieldSet (defaults to '') - */ - /** - * @cfg {String/Object} autoCreate - * A DomHelper element spec used to autocreate the fieldset (defaults to {tag: 'fieldset', cn: {tag:'legend'}}) - */ - - // private - defaultAutoCreate : {tag: 'fieldset', cn: {tag:'legend'}}, - - // private - onRender : function(ct, position){ - Roo.form.FieldSet.superclass.onRender.call(this, ct, position); - if(this.legend){ - this.setLegend(this.legend); - } - }, - - // private - setLegend : function(text){ - if(this.rendered){ - this.el.child('legend').update(text); - } - } -}); \ No newline at end of file