examples/bootstrap/LocationPicker.js
[roojs1] / examples / bootstrap / LocationPicker.js
1
2
3 Roo.example = Roo.example || {};
4
5 Roo.example.locationpicker = 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         
25         return {
26             xtype: 'Body',
27             xns: Roo.bootstrap,
28             items :
29             [
30                 {
31                     xtype : 'Container',
32                     xns : Roo.bootstrap,
33                     cls : 'col-md-12',
34                     items : [
35                         {
36                             xtype : 'LocationPicker',
37                             xns: Roo.bootstrap,
38                             style : 'width:500px; height: 400px; border: 1px solid #000;margin:50px auto;',
39                             latitude : 46.15242437752303,
40                             longitude : 2.7470703125,
41                             radius : 300,
42                             listeners : {
43                                 render : function (_self) {
44                                     _this.picker = _self;
45                                 },
46                                 positionchanged : function (_self, location) {
47                                     Roo.log(location);
48                                     
49                                     if(_this.latitude){
50                                         _this.latitude.setValue(0);
51                                     }
52                                     
53                                     if(_this.latitude){
54                                         _this.longitude.setValue(0);
55                                     }
56                                 }
57                             }
58                         }
59                     ]
60                 },
61                 {
62                     xtype : 'Container',
63                     xns : Roo.bootstrap,
64                     cls : 'col-md-12',
65                     style : 'margin:auto;',
66                     items : [
67                         {
68                             xtype : 'Column',
69                             xns: Roo.bootstrap,
70                             md : 3,
71                             cls : 'col-md-offset-3',
72                             items : [
73                                 {
74                                     xtype : 'Input',
75                                     xns: Roo.bootstrap,
76                                     fieldLabel : 'Latitude',
77                                     labelAlign : 'top',
78                                     listeners : {
79                                         render : function (_self) {
80                                             _this.latitude = _self;
81                                         }
82                                     }
83                                 }
84                             ]
85                         },
86                         {
87                             xtype : 'Column',
88                             xns: Roo.bootstrap,
89                             md : 3,
90                             items : [
91                                 {
92                                     xtype : 'Input',
93                                     xns: Roo.bootstrap,
94                                     fieldLabel : 'Longitude',
95                                     labelAlign : 'top',
96                                     listeners : {
97                                         render : function (_self) {
98                                             _this.longitude = _self;
99                                         }
100                                     }
101                                 }
102                             ]
103                         }
104                     ]
105                 }
106             ]
107         }
108     }
109 });