1. #1
    Sencha User talha06's Avatar
    Join Date
    Jul 2009
    Location
    Turkey
    Posts
    303
    Answers
    8
    Vote Rating
    0
    talha06 is on a distinguished road

      0  

    Default Unanswered: GMapPanel3 how to add markers dynamically?

    Unanswered: GMapPanel3 how to add markers dynamically?


    Hello everyone,

    As I know, the google maps extension for ExtJS 4 is VinylFox's GMapPanel3 - as he shared here -.
    I just want to learn if someone has also played with it, how can I add markers dynamically? i.e. I'm using store for markers that will be added after center marker has rendered. I did it with using Sencha Touch. Ext.Map was very successful and I use Google Maps API v3 with it.
    The code that I use for ExtJS 4 is here:
    Code:
    // this is my panel; this.map is gmappanel
    this.on('afterrender', function() {                
    var store = Ext.create(appName + '.store.Markers');
    store.load({
                callback: function(records, operation, success) {
                            Ext.each(records, function(rec) {
                                console.log(rec.raw.title + ' ==> ' + rec.raw.lat +  ' : ' + rec.raw.lng);
                                var tmpPoint = new google.maps.LatLng(rec.raw.lat,rec.raw.lng);
                                var tmp = new google.maps.Marker({
                                    position    : new google.maps.LatLng(rec.raw.lat,rec.raw.lng),
                                    lat            : rec.raw.lat,
                                    lng            : rec.raw.lng,
                                    title        : rec.raw.title,
                                    infoWindow    : 'Sonradan eklenen',
                                    icon        : pinImageRed,
                                    shadow        : pinShadow,
                                    animation     : google.maps.Animation.DROP
                                });
                                me.map.addMarker(tmpPoint, tmp, false, false);
                                google.maps.event.addListener(tmp, 'click', function() { 
                                       infoBubble.setContent(tmp.getTitle());
                                      infoBubble.open(me.map, tmp);
                                });
                            });
                        }
                    });
            });
    I tried 'render, beforeshow, beforerender, etc.' events but I haven't got any results yet.
    I'll be happy if someone can help me.
    Thanks in advance.
    With regards,
    T
    "People will never forget how you made them feel."
    linkedin.com/in/talhakabakus

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,884
    Answers
    653
    Vote Rating
    440
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    I believe you will have to use the Google API direct to perform this.

    Scott.

Thread Participants: 1

Tags for this Thread