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                                     var position = this.getCurrentPosition();
48                                     
49                                     _this.latitude.setValue(position.latitude);
50                                     _this.longitude.setValue(position.longitude);
51                                 }
52                             }
53                         }
54                     ]
55                 },
56                 {
57                     xtype : 'Container',
58                     xns : Roo.bootstrap,
59                     cls : 'col-md-12',
60                     style : 'margin:auto;',
61                     items : [
62                         {
63                             xtype : 'Column',
64                             xns: Roo.bootstrap,
65                             md : 3,
66                             cls : 'col-md-offset-3',
67                             items : [
68                                 {
69                                     xtype : 'Input',
70                                     xns: Roo.bootstrap,
71                                     fieldLabel : 'Latitude',
72                                     labelAlign : 'top',
73                                     listeners : {
74                                         render : function (_self) {
75                                             _this.latitude = _self;
76                                         }
77                                     }
78                                 }
79                             ]
80                         },
81                         {
82                             xtype : 'Column',
83                             xns: Roo.bootstrap,
84                             md : 3,
85                             items : [
86                                 {
87                                     xtype : 'Input',
88                                     xns: Roo.bootstrap,
89                                     fieldLabel : 'Longitude',
90                                     labelAlign : 'top',
91                                     listeners : {
92                                         render : function (_self) {
93                                             _this.longitude = _self;
94                                         }
95                                     }
96                                 }
97                             ]
98                         }
99                     ]
100                 }
101             ]
102         }
103     }
104 });