Results 1 to 3 of 3

Thread: Ext.ux.GMapPanel with markers takern from server?

  1. #1

    Default Ext.ux.GMapPanel with markers takern from server?

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

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716

    Default

    Moved to Q&A.

    Scott.

  3. #3

    Default

    thanks Scott,

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •