allow string based values for comboboxarray
[roojs1] / Roo / CalendarPanel.js
index 2a8bb6e..1755aa4 100644 (file)
@@ -18,6 +18,7 @@
 
 Roo.CalendarPanel = function(config){
     
+    Roo.log("cal panel ctr");
   
     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);
@@ -26,6 +27,8 @@ Roo.CalendarPanel = function(config){
     
     Roo.CalendarPanel.superclass.constructor.call(this, this.wrapper, config);
     
+    Roo.log(this.el);
+    
     if(this.toolbar){
         this.toolbar.el.insertBefore(this.wrapper.dom.firstChild);
     }
@@ -37,16 +40,20 @@ Roo.CalendarPanel = function(config){
         //this.footer = Roo.factory(this.footer, Roo);
         
     }
+    this.view = new Roo.calendar.View(Roo.apply({
+        skipNavHeader : true,
+        skipMonthHeader : false
+        
+    },config));
     
-     this.on('activate', function()
+     
+    this.on('activate', function()
     {
-        if (this.rendered) {
-            return;
-        }
-        this.rendered = true;
+        Roo.log('activate');
+         
         //console.log('render tree');
         this.render();
-    },true);
+    },this);
     
     this.addEvents({
         /**
@@ -83,49 +90,86 @@ Roo.CalendarPanel = function(config){
             * @param {Calendar} this
             * @param {event}
             */
-        'eventclick': true
+        'eventclick': true,
+        /**
+            * @event rendered
+            * Fires when the grid is rendered
+            * @param {Calendar} this
+           
+            */
+        'rendered': true
+        
         
     });
-    
+    this.relayEvents(this.view, ["select","monthchange","evententer","eventleave","rendered"]);
+
     //this.grid = grid;
     //this.grid.getGridEl().replaceClass("x-layout-inactive-content", "x-layout-component-panel");
 };
 
+
 Roo.extend(Roo.CalendarPanel, Roo.ContentPanel, {
-    getId : function(){
-        return this.id;
-    },
-    /*
-    setSize : function(width, height){
-        if(!this.ignoreResize(width, height)){
-            var grid = this.grid;
-            var size = this.adjustForComponents(width, height);
-            grid.getGridEl().setSize(size.width, size.height);
-            grid.autoSize();
-        }
-    },
-    
-    beforeSlide : function(){
-        this.grid.getView().scroller.clip();
-    },
     
-    afterSlide : function(){
-        this.grid.getView().scroller.unclip();
-    },
-    */
-    destroy : function(){
-      //  this.grid.destroy();
-       // delete this.grid;
-         Roo.GridPanel.superclass.destroy.call(this); 
+      
+    render : function()
+    {
+        var ct = this.el.appendChild(document.createElement("div"));
+        this.onRender(this.el, false)
     },
     
-    
-    render : function()
+    onRender : function(ct, position)
     {
+        if (this.rendered) {
+            return;
+        }
+        this.rendered = true;
         
         Roo.log("render calendar");
         
         
+        //Roo.bootstrap.Component.superclass.onRender.call(this, ct, position);
+        
+        
+        var cfg = Roo.apply({},  this.view.getAutoCreate());
+        cfg.id = Roo.id();
+        
+        // fill in the extra attributes 
+        if (this.xattr && typeof(this.xattr) =='object') {
+            for (var i in this.xattr) {
+                cfg[i] = this.xattr[i];
+            }
+        }
+        
+        if(this.dataId){
+            cfg.dataId = this.dataId;
+        }
+        
+        if (this.cls) {
+            cfg.cls = (typeof(cfg.cls) == 'undefined') ? this.cls : cfg.cls + ' ' + this.cls;
+        }
+        
+        if (this.style) { // fixme needs to support more complex style data.
+            cfg.style = this.style;
+        }
+        
+        if(this.name){
+            cfg.name = this.name;
+        }
+        
+        this.view.el =  ct.createChild(cfg, position);
+        
+        //if(this.tabIndex !== undefined){
+        //    this.el.dom.setAttribute('tabIndex', this.tabIndex);
+        //}
+        
+        
+        this.view.initEvents();
+        this.fireEvent('rendered');
     }
     
+    
+    
+    
 });
+