google-mapssencha-touch

How to add map listeners onto map page


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',

            }

What can I try next?


Solution

  • 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