3 Roo.example = Roo.example || {};
5 Roo.example.locationpicker = new Roo.XComponent({
6 part : ["layout","viewpanel"],
7 order : '001-viewpanel',
10 name : "unnamed module",
17 el : new Roo.bootstrap.Body()
19 this.parent.el.layout = false;
20 this.parent.el.render(document.body);
38 cls : 'col-md-offset-3',
39 style : 'margin-top: 50px',
44 fieldLabel : 'Location',
46 render : function (_self) {
47 _this.location = _self;
60 xtype : 'LocationPicker',
62 style : 'width:500px; height: 400px; border: 1px solid #000;margin:50px auto;',
64 longitude : 114.1751471,
65 markerTitle : 'Drag Me',
67 render : function (_self) {
70 this.gMapContext.autocomplete = new google.maps.places.Autocomplete(_this.location.inputEl().dom);
72 google.maps.event.addListener(this.gMapContext.autocomplete, "place_changed", function() {
73 var place = _this.picker.gMapContext.autocomplete.getPlace();
74 if (!place.geometry) {
75 Roo.log('location not found');
78 _this.picker.setPosition(place.geometry.location);
82 positionchanged : function (_self, location) {
84 _this.latitude.setValue(location.lat());
88 _this.longitude.setValue(location.lng());
107 fieldLabel : 'Latitude',
110 render : function (_self) {
111 _this.latitude = _self;
125 fieldLabel : 'Longitude',
128 render : function (_self) {
129 _this.longitude = _self;