How to add map listeners onto map page

扶醉桌前 提交于 2020-01-06 12:49:50

问题


How to I add a map listener to my first map page? I saw many examples which create a map and put it into a page, but here in my code, the map itself is a page. So I do not know how to add map listeners in this way.

Ext.define('myapp.view.Main', {
    extend: 'Ext.tab.Panel',
    xtype: 'main',
    fullscreen: true,
    requires: [
        'Ext.TitleBar',
        'Ext.Video',
        'Ext.Map',
        'Ext.Panel',
        'Ext.tab.*',
        'Ext.*'
    ],
    config: {
        tabBarPosition: 'bottom',

      items: [
            {
                title: 'WebTrack',
                iconCls:'maps',
                xtype: 'map',
                useCurrentLocation: true,
                store: 'my.store.appleStore',

            }

Can someone help please?

Thanks very much


回答1:


Finally, I found the answer.

Steps to follow:

  1. create a map component in controller.
  2. Ext.define('myapp.controller.Noises', { extend: 'Ext.app.Controller', requires: ['Ext.MessageBox'], config: { refs: { mapComponent: 'main map' }, control: { mapComponent: { maprender: 'onMaprender' } } },

So the onMapprender is where you can start to write your code.

Hope it helps.

Cheers



来源:https://stackoverflow.com/questions/22865259/how-to-add-map-listeners-onto-map-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!