PDA

View Full Version : Ext.ux.GMapPanel with markers takern from server?



arpeggian
1 Sep 2012, 2:09 PM
How do I make gmappanel with markers taken from the server? I'm using ExtJS 4 and I use Ext.ux.GMapPanel made ​​by VinylFox (https://github.com/VinylFox/ExtJS.ux.GMapPanel)


this is my code


Ext.Ajax.request({
url: sharedData.rootDir + 'app/DPM/getMarkers.php',
method: 'GET',
params: {
kolok: kolok,
bulan: bulan_stand,
tahun: tahun_stand
},
success: function(response){
var data = Ext.decode(response.responseText);
box.hide();

Ext.create('Ext.Window', {
layout: 'fit',
title: 'Google Maps',
width:800,
height:600,
items: {
xtype: 'gmappanel',
itemId: 'rbm-map',
zoomLevel: 8,
gmapType: 'map',
mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
mapControls: ['GSmallMapControl','GMapTypeControl'],
setCenter: {
lat: -5.41018985,
lng: 105.25238984
},
},
listeners: {
'beforerender' : function(win){
var markers = [];
Ext.each(data.markers, function(obj, index) {
markers.push(
{
lat: obj.lat,
lng: obj.lng,
marker: obj.marker
}
);
});
win.getComponent('rbm-map').addMarkers(markers);
},
'beforeshow' : function(win){
var markers = [];
Ext.each(data.markers, function(obj, index) {
markers.push(
{
lat: obj.lat,
lng: obj.lng,
marker: obj.marker
}
);
});
win.getComponent('rbm-map').addMarkers(markers);
}
}
}).show();

},
failure: function(response){
var data = Ext.decode(response.responseText);
box.hide();



}
});


Please help me

scottmartin
1 Sep 2012, 10:10 PM
Moved to Q&A.

Scott.

arpeggian
2 Sep 2012, 7:27 AM
thanks Scott, :):D