X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2FComponent.js;h=7f7893335838d2c288d610d613a2964c0a68880c;hb=61bc45258e16a779856dd2ad0862630b489e4583;hp=1b458f37e9f584ae2966e66071a62e8e159cd71a;hpb=6f4cc8b10cabffc6e13efeb32c8594b0c37a893a;p=roojs1 diff --git a/Roo/Component.js b/Roo/Component.js index 1b458f37e9..7f78933358 100644 --- a/Roo/Component.js +++ b/Roo/Component.js @@ -28,8 +28,7 @@ Roo.Component = function(config){ config = {el: config, id: config.id || config}; } this.initialConfig = config; - Roo.log('config'); - Roo.log(config); + Roo.apply(this, config); this.addEvents({ /** @@ -94,7 +93,7 @@ Roo.Component = function(config){ destroy : true }); if(!this.id){ - this.id = "ext-comp-" + (++Roo.Component.AUTO_ID); + this.id = "roo-comp-" + (++Roo.Component.AUTO_ID); } Roo.ComponentMgr.register(this); Roo.Component.superclass.constructor.call(this); @@ -134,7 +133,7 @@ Roo.extend(Roo.Component, Roo.util.Observable, { * Whether the component can move the Dom node when rendering (defaults to true). */ allowDomMove : true, - /** @cfg {String} hideMode + /** @cfg {String} hideMode (display|visibility) * How this component should hidden. Supported values are * "visibility" (css visibility), "offsets" (negative offset position) and * "display" (css display) - defaults to "display". @@ -147,7 +146,7 @@ Roo.extend(Roo.Component, Roo.util.Observable, { /** * @cfg {String} actionMode * which property holds the element that used for hide() / show() / disable() / enable() - * default is 'el' + * default is 'el' for forms you probably want to set this to fieldEl */ actionMode : "el", @@ -162,40 +161,49 @@ Roo.extend(Roo.Component, Roo.util.Observable, { * @param {String/HTMLElement/Element} container (optional) The element this component should be rendered into. If it is being applied to existing markup, this should be left off. */ render : function(container, position){ - if(!this.rendered && this.fireEvent("beforerender", this) !== false){ - if(!container && this.el){ - this.el = Roo.get(this.el); - container = this.el.dom.parentNode; - this.allowDomMove = false; - } - this.container = Roo.get(container); - this.rendered = true; - if(position !== undefined){ - if(typeof position == 'number'){ - position = this.container.dom.childNodes[position]; - }else{ - position = Roo.getDom(position); - } - } - this.onRender(this.container, position || null); - if(this.cls){ - this.el.addClass(this.cls); - delete this.cls; - } - if(this.style){ - this.el.applyStyles(this.style); - delete this.style; - } - this.fireEvent("render", this); - this.afterRender(this.container); - if(this.hidden){ - this.hide(); - } - if(this.disabled){ - this.disable(); + + if(this.rendered){ + return this; + } + + if(this.fireEvent("beforerender", this) === false){ + return false; + } + + if(!container && this.el){ + this.el = Roo.get(this.el); + container = this.el.dom.parentNode; + this.allowDomMove = false; + } + this.container = Roo.get(container); + this.rendered = true; + if(position !== undefined){ + if(typeof position == 'number'){ + position = this.container.dom.childNodes[position]; + }else{ + position = Roo.getDom(position); } } + this.onRender(this.container, position || null); + if(this.cls){ + this.el.addClass(this.cls); + delete this.cls; + } + if(this.style){ + this.el.applyStyles(this.style); + delete this.style; + } + this.fireEvent("render", this); + this.afterRender(this.container); + if(this.hidden){ + this.hide(); + } + if(this.disabled){ + this.disable(); + } + return this; + }, /** @private */