roojs-all.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                                             _this.popover.hide();
53                                         },
54                                         monthchange : function(e,data) {
55                                             
56                                         }
57                                     },
58                                     store : {
59                                         xtype: 'Store',
60                                         xns: Roo.data,
61                                         listeners : {
62                                             beforeload : function (_self, o){
63                                                 o.params = o.params || {};
64                                                 var d = new Date().format('Y-m-d');
65                                                 if(_this.cal){
66                                                     d = typeof(_this.cal.activeDate) == 'string' ? _this.cal.activeDate : _this.cal.activeDate.format("Y-m-d");
67                                                 }
68                                                 o.params._activeDate = d
69                                             }
70                                         },
71                                         remoteSort : true,
72                                         sortInfo : { direction : 'ASC', field: 'start_dt' },
73                                         proxy : {
74                                             xtype: 'HttpProxy',
75                                             xns: Roo.data,
76                                             method : 'GET',
77                                             url : baseURL + '/Roo/Cal_event.php'
78                                         },
79                                         reader : {
80                                             xtype: 'JsonReader',
81                                             xns: Roo.data,
82                                             id : 'id',
83                                             root : 'data',
84                                             totalProperty : 'total',
85                                             fields : [{"name":"id","type":"int"},{"name":"title","type":"string"}]
86                                         }
87                                     }
88                                  }
89                             ]
90                         }
91                     ]
92                  },
93                   {
94                     xtype: 'Popover',
95                     xns: Roo.bootstrap,
96                     title : "test popover",
97                     html : "test content",
98                     trigger : false,
99                     listeners : {
100                         render : function(args) {
101                             _this.popover = this;
102                         }
103                     }
104                 }
105             ]
106         };
107     }
108 });