From 110ee7ea500c147c05758d9cc28d2f80981958e8 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 1 Aug 2011 10:29:45 +0000 Subject: [PATCH] Roo.ContentPanel - add @property view, which can hold the view element - eg. View/JsonView or DatePicker if it has been added. --- Roo/ContentPanel.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Roo/ContentPanel.js b/Roo/ContentPanel.js index 399efd7ea1..157d1a2289 100644 --- a/Roo/ContentPanel.js +++ b/Roo/ContentPanel.js @@ -12,13 +12,13 @@ * @class Roo.ContentPanel * @extends Roo.util.Observable * A basic ContentPanel element. - * @cfg {Boolean} fitToFrame True for this panel to adjust its size to fit when the region resizes (defaults to false) - * @cfg {Boolean} fitContainer When using {@link #fitToFrame} and {@link #resizeEl}, you can also fit the parent container (defaults to false) + * @cfg {Boolean} fitToFrame True for this panel to adjust its size to fit when the region resizes (defaults to false) + * @cfg {Boolean} fitContainer When using {@link #fitToFrame} and {@link #resizeEl}, you can also fit the parent container (defaults to false) * @cfg {Boolean/Object} autoCreate True to auto generate the DOM element for this panel, or a {@link Roo.DomHelper} config of the element to create - * @cfg {Boolean} closable True if the panel can be closed/removed - * @cfg {Boolean} background True if the panel should not be activated when it is added (defaults to false) + * @cfg {Boolean} closable True if the panel can be closed/removed + * @cfg {Boolean} background True if the panel should not be activated when it is added (defaults to false) * @cfg {String/HTMLElement/Element} resizeEl An element to resize if {@link #fitToFrame} is true (instead of this panel's element) - * @cfg {Toolbar} toolbar A toolbar for this panel + * @cfg {Toolbar} toolbar A toolbar for this panel * @cfg {Boolean} autoScroll True to scroll overflow in this panel (use with {@link #fitToFrame}) * @cfg {String} title The title for this panel * @cfg {Array} adjustments Values to add to the width/height when doing a {@link #fitToFrame} (default is [0, 0]) @@ -344,6 +344,18 @@ panel.load({ this.el = null; }, + /** + * form - if the content panel contains a form - this is a reference to it. + * @type {Roo.form.Form} + */ + form : false, + /** + * view - if the content panel contains a view (Roo.DatePicker / Roo.View / Roo.JsonView) + * This contains a reference to it. + * @type {Roo.View} + */ + view : false, + /** * Adds a xtype elements to the panel - currently only supports Forms, View, JsonView. *

@@ -369,18 +381,17 @@ layout.addxtype({
             if ( this.form.allItems.length) this.form.render(el.dom);
             return this.form;
         }
-        
+        // should only have one of theses..
         if (['View', 'JsonView', 'DatePicker'].indexOf(cfg.xtype) > -1) {
             // views..
             cfg.el = this.el.appendChild(document.createElement("div"));
             // factory?
             var ret = new Roo[cfg.xtype](cfg);
-            ret.render(false, ''); // render blank..
+            ret.render && ret.render(false, ''); // render blank..
+            this.view = ret;
             return ret;
-            
         }
         return false;
-        
     }
 });
 
-- 
2.39.2