examples/bootstrap/calendar.js
[roojs1] / examples / bootstrap / calendar.js
1
2
3 Roo.example = Roo.example || {};
4
5 Roo.example.calendar = new Roo.XComponent({
6     part     :  ["layout","viewpanel"],
7     order    : '001-viewpanel',
8     region   : '',
9     parent   : '#bootstrap',
10     name     : "unnamed module",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         
16         this.parent = {
17             el : new Roo.bootstrap.Body()
18         }
19         this.parent.el.layout = false;
20         this.parent.el.render(document.body);
21         
22         var _this = this;
23         var MODULE = this;
24         var baseURL = '/web.eventmanager/admin.php';
25         
26         return {
27             xtype: 'Body',
28             xns: Roo.bootstrap,
29             items : [
30                  {
31                     xtype: 'Container',
32                     xns: Roo.bootstrap,
33                     style :  'margin-top:50px', 
34                     items : [
35                         {
36                             xtype: 'Row',
37                             xns: Roo.bootstrap,
38                             style :  'margin-top:50px',
39                             items : [
40                                 { 
41                                     xtype: 'Calendar',
42                                     xns: Roo.bootstrap,
43                                     cls : 'col-md-6 col-sm-12',
44                                     listeners : {
45                                         render : function() {
46                                             _this.cal = this;
47                                         },
48                                         evententer : function(e,el,data) {
49                                             _this.popover.show(el)
50                                         },
51                                         eventleave : function(e,el,data) {
52                                             Roo.log('event leave');
53                                             _this.popover.hide();
54                                         },
55                                         monthchange : function(e,data) {
56                                             
57                                         }
58                                     },
59                                     store : {
60                                         xtype: 'Store',
61                                         xns: Roo.data,
62                                         listeners : {
63                                             beforeload : function (_self, o){
64                                                 Roo.log('beforeload');
65                                                 Roo.log(_this);
66                                                 o.params = o.params || {};
67                                                 var d = new Date().format('Y-m');
68                                                 if(_this.cal){
69                                                     d = typeof(_this.cal.activeDate) == 'string' ? _this.cal.activeDate : _this.cal.activeDate.format("Y-m");
70                                                 }
71                                                 o.params._activeDate = d
72                                             }
73                                         },
74                                         remoteSort : true,
75                                         sortInfo : { direction : 'ASC', field: 'start_dt' },
76                                         proxy : {
77                                             xtype: 'HttpProxy',
78                                             xns: Roo.data,
79                                             method : 'GET',
80                                             url : baseURL + '/Roo/Cal_event.php'
81                                         },
82                                         reader : {
83                                             xtype: 'JsonReader',
84                                             xns: Roo.data,
85                                             id : 'id',
86                                             root : 'data',
87                                             totalProperty : 'total',
88                                             fields : [{"name":"id","type":"int"},{"name":"title","type":"string"}]
89                                         }
90                                     }
91                                  }
92                             ]
93                         }
94                     ]
95                  },
96                   {
97                     xtype: 'Popover',
98                     xns: Roo.bootstrap,
99                     title : "test popover",
100                     html : "test content",
101                     trigger : false,
102                     listeners : {
103                         render : function(args) {
104                             _this.popover = this;
105                         }
106                     }
107                 }
108             ]
109         };
110     }
111 });