问题
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:
- create a map component in controller.
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