PDA

View Full Version : Map rendering With Store LontLat



myput
30 Sep 2011, 12:16 AM
Hey,

i have a problem with the rendering of my map.
I have a list with a store from Json, who contain Longitude and latitude to an Item.
And in my View, i have a TabPanel.
I can get the infos from the store, that's good.


itemtap: function(view, index, item, e) {
var record = WPApp.stores.DirectoryNameListPanelStore.getAt(index);
WPApp.views.DirectoryDetailPanelToolbar.setTitle(record.data.NAME);
WPApp.views.DirectoryDetailPanelInformation.update(record.data);
WPApp.views.DirectoryDetailPanelGeoLocation.addMap(record.data);
WPApp.views.DirectoryPanel.setActiveItem(WPApp.views.DirectoryDetailPanel, {type: 'fade'});
}


But i don't know to show the map and where, cause my code makes problems.

And in DirectoryDetailPanelGeoLocation:


WPApp.views.DirectoryDetailPanelGeoLocation = new Ext.Panel ({
title: 'GeoLocation',
fullscreen: true,
addMap: function(data) {
var pos = new google.maps.LatLng(data.LATITUDE, data.LONGITUDE);
alert(pos);
map = new Ext.Map({
fullscreen: true,
center: pos,
});
},
});


If i do an alert(pos); i have my good location from Json. I just can't show the map with this informations ... Don't know why.

Can you help me please?

simondavies
30 Sep 2011, 12:23 AM
I am going through a similar situation, have your tried to display your map panel on its own with predefined coordinates etc to ensure that the panel displays ok, thus eliminating your map panel as an issue etc. This is how I started I made sure all works well so limiting the errors then tried to work out what I need to do.. still trying.

Also to be devils advocate is there and error, if so what? and have you included the Google api script within the top of your main page etc.

myput
30 Sep 2011, 12:34 AM
Yes it's working, if i do raw lont lat ...


var myMap = new Ext.Map({
mapOptions : {
zoom: 12,
timeout: 10000,
maximumAge: 20000,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.DEFAULT
},
autoUpdate:true,
center: new google.maps.LatLng(45.936661, 6.630557),
},
});


WPApp.views.DirectoryDetailPanelGeoLocation = new Ext.Panel ({
title: 'GeoLocation',
fullscreen: true,
addMap: function(data) {
var pos = new google.maps.LatLng(data.LATITUDE, data.LONGITUDE);
},
items: [myMap],
});


But i can't access to 'pos' ...