2015-09-04 7 views
0

Как impement нажмите событие в ExtJS в документации https://docs.sencha.com/extjs/4.2.3/#!/api/Ext.ux.GMapPanel-method-addListener Я знаю, что в javascritpt но ExtJs, как сделать что google map js я сделал много кликов слушателей, но без Succes, пожалуйста, вы можете сказать по щелчку должен быть контроллером по ссылке и так далее?Нажмите событие в GmapPanel

Ext.define('App.view.App', { 
     extend: 'Ext.window.Window', 
     alias: 'widget.appform', 
     title:'', 
     operation:'', 
     resizable: false, 
     modal:true, 
     initComponent: function() { 
      me = this; 
      this.autoShow = true; 
      this.width = 550; 
      this.height = 650; 
      this.items = [ 
       { 
        xtype: 'textfield', 
        name: 'title', 
        value:me.login, 
        fieldLabel: 'Title', 
        allowBlank: false, 
        width:330, 
        style:{ 
         marginTop:'10px', 
         marginLeft:'20px', 
         marginRight:'20px' 
        } 
       }, 

       { 
        title: 'Google Map', 
        width:535, 
        height:800, 
       // frame:true, 
         id:'gmapForm', 
        // height: '100%', 
        xtype: 'gmappanel', 
        gmapType: 'map', 
        center: { 
         geoCodeAddr: "221B Baker Street", 
         marker: { 
          title: 'Holmes Home' 
         } 
        }, 
        mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'], 
        mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'], 
        mapOptions : { 
         mapTypeId: google.maps.MapTypeId.ROADMAP 
        }, 
        listeners: { 

         maprender: function(extMapComponent, googleMapComp){ 

          var marker = new google.maps.Marker({ 
           position: position = new google.maps.LatLng (42.16726190,-87.83146810), 
           // position: patientPosition, //patientPosition initialized in geocodePatientAddress() function in Home.js 
           map: googleMapComp, 
           animation: google.maps.Animation.DROP, 
           draggable: false, 
           title: 'Patient Location' 

          }); 

          google.maps.event.addListener(marker, 'click', function() { 
           // infowindow.open(googleMapComp, marker); 
           console.log('sssssssssss'); 
          }); 

          google.maps.event.addListener(marker, 'mouseout', function() { 
           infowindow.close(googleMapComp, marker); 
          }); 
         } 

        }, 
        handler : function() { 
         google.maps.event.addListener(marker, 'click', function() { 
          // infowindow.open(googleMapComp, marker); 
          console.log('sssssssssss'); 
         }); 
         // this.up('window').down('form').getForm().reset(); 
        } 


        /* google.maps.event.addListener(gObject, "click", function(e){ 
         alert('test'); 
        })*/ 

       } 

      ]; 
      this.buttons = [ 
       { 
        text:me.operation, 
        name: me.operation, 
        scope: this 
       }, 

      ]; 
      console.log(arguments); 
      this.callParent(arguments); 
     } 
    }); 

ответ

1

Плагин Google maps для extjs имеет проблему imo.

Вы можете напрямую интегрироваться с картами google api и extjs.

Вот пример с поиска и наложения функций:

https://fiddle.sencha.com/#fiddle/cva

Что касается событий щелчка вы будете использовать:

marker.addListener('click', function() { 
map.setZoom(8); 
map.setCenter(marker.getPosition()); 
}); 

https://developers.google.com/maps/documentation/javascript/events

Смежные вопросы