Roo/Template.js
[roojs1] / Roo / ContentPanel.js
index cad01ef..30f3538 100644 (file)
@@ -336,7 +336,7 @@ panel.load({
     },
     
       /**
-     * Adds a xtype elements to the panel - currently only supports Forms.
+     * Adds a xtype elements to the panel - currently only supports Forms, View, JsonView.
      * <pre><code>
 
 layout.addxtype({
@@ -351,14 +351,25 @@ layout.addxtype({
     
     addxtype : function(cfg) {
         // add form..
-        if (!cfg.xtype.match(/^Form$/)) {
-            return false;
+        if (cfg.xtype.match(/^Form$/)) {
+            var el = this.el.createChild();
+
+            this.form = new  Roo.form.Form(cfg);
+            
+            
+            if ( this.form.allItems.length) this.form.render(el.dom);
+            return this.form;
         }
-        var el = this.el.createChild();
-        this.form = new  Roo.form.Form(cfg);
-        
-        if ( this.form.allItems.length) this.form.render(el.dom);
-        return this.form;
+        if (['View', 'JsonView'].indexOf(cfg.xtype) > -1) {
+            // views..
+            cfg.el = this.el;
+            // factory?
+            var ret = new Roo[cfg.xtype](cfg);
+            ret.render(false, ''); // render blank..
+            return ret;
+            
+        }
+        return false;
         
     }
 });
@@ -373,10 +384,7 @@ layout.addxtype({
  */
 Roo.GridPanel = function(grid, config){
     
-    if (typeof(config) == 'undefined') { // xtype construction..
-        config = grid;
-        grid = Roo.factory(config.grid, Roo);
-    }
+  
     this.wrapper = Roo.DomHelper.append(document.body, // wrapper for IE7 strict & safari scroll issue
         {tag: "div", cls: "x-layout-grid-wrapper x-layout-inactive-content"}, true);