Roo/CalendarPanel.js
[roojs1] / Roo / CalendarPanel.js
1 /*
2  * - LGPL
3  *
4  * based on jquery fullcalendar
5  * 
6  */
7
8
9 /**
10  * @class Roo.Calendar
11  * @extends Roo.Component
12  * Bootstrap Calendar class
13     
14  * @constructor
15  * Create a new Container
16  * @param {Object} config The config object
17  */
18
19 Roo.CalendarPanel = function(config){
20     
21   
22     this.wrapper = Roo.DomHelper.append(document.body, // wrapper for IE7 strict & safari scroll issue
23         {tag: "div", cls: "x-layout-grid-wrapper x-layout-inactive-content"}, true);
24         
25     //this.wrapper.dom.appendChild(grid.getGridEl().dom);
26     
27     Roo.CalendarPanel.superclass.constructor.call(this, this.wrapper, config);
28     
29     if(this.toolbar){
30         this.toolbar.el.insertBefore(this.wrapper.dom.firstChild);
31     }
32     // xtype created footer. - not sure if will work as we normally have to render first..
33     if (this.footer && !this.footer.el && this.footer.xtype) {
34         
35         //this.footer.container = this.grid.getView().getFooterPanel(true);
36         //this.footer.dataSource = this.grid.dataSource;
37         //this.footer = Roo.factory(this.footer, Roo);
38         
39     }
40     
41      this.on('activate', function()
42     {
43         if (this.rendered) {
44             return;
45         }
46         this.rendered = true;
47         //console.log('render tree');
48         this.tree.render();
49     },true);
50     
51     this.addEvents({
52         /**
53              * @event select
54              * Fires when a date is selected
55              * @param {DatePicker} this
56              * @param {Date} date The selected date
57              */
58         'select': true,
59         /**
60              * @event monthchange
61              * Fires when the displayed month changes 
62              * @param {DatePicker} this
63              * @param {Date} date The selected month
64              */
65         'monthchange': true,
66         /**
67              * @event evententer
68              * Fires when mouse over an event
69              * @param {Calendar} this
70              * @param {event} Event
71              */
72         'evententer': true,
73         /**
74              * @event eventleave
75              * Fires when the mouse leaves an
76              * @param {Calendar} this
77              * @param {event}
78              */
79         'eventleave': true,
80         /**
81              * @event eventclick
82              * Fires when the mouse click an
83              * @param {Calendar} this
84              * @param {event}
85              */
86         'eventclick': true
87         
88     });
89     
90     //this.grid = grid;
91     //this.grid.getGridEl().replaceClass("x-layout-inactive-content", "x-layout-component-panel");
92 };
93
94 Roo.extend(Roo.CalendarPanel, Roo.ContentPanel, {
95     getId : function(){
96         return this.id;
97     },
98     /*
99     setSize : function(width, height){
100         if(!this.ignoreResize(width, height)){
101             var grid = this.grid;
102             var size = this.adjustForComponents(width, height);
103             grid.getGridEl().setSize(size.width, size.height);
104             grid.autoSize();
105         }
106     },
107     
108     beforeSlide : function(){
109         this.grid.getView().scroller.clip();
110     },
111     
112     afterSlide : function(){
113         this.grid.getView().scroller.unclip();
114     },
115     */
116     destroy : function(){
117       //  this.grid.destroy();
118        // delete this.grid;
119          Roo.GridPanel.superclass.destroy.call(this); 
120     }
121 });