如何将地图监听器添加到地图页面上 [英] How to add map listeners onto map page
问题描述
如何将地图侦听器添加到我的第一个地图页面?
我看到很多创建地图并将其放入页面的示例,但在我的代码中,地图本身就是一个页面。
所以我不知道如何以这种方式添加地图监听器。
Ext.define('myapp.view .Main',{
extend:'Ext.tab.Panel',
xtype:'main',
fullscreen:true,
require:[
'Ext .TitleBar',
'Ext.Video',
'Ext.Map',
'Ext.Panel',
'Ext.tab。*',
'分机*'
],
配置:{
tabBarPosition:'bottom',
物品:[
{
title: 'WebTrack',
iconCls:'maps',
xtype:'map',
useCurrentLocation:true,
store:'my.store.appleStore',
}
有人可以帮忙吗?
非常感谢
最后,我找到了答案。
遵循以下步骤:
- 在控制器中创建映射组件。
Ext.define('myapp.controller.Noises',{
extend:'Ext.app.Controller',
require:['Ext.MessageBox'],
config:{
refs:{
mapComponent:'main map '
},
control:{
mapComponent:{
maprender:'onMaprender'
}
}
},
因此,onMapprender是您可以开始编写代码的地方。
希望它有帮助。
干杯
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
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
这篇关于如何将地图监听器添加到地图页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!