Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8342109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:40:35+00:00 2026-06-09T05:40:35+00:00

here is my code. I want to add dynamicly markers from store or another

  • 0

here is my code. I want to add dynamicly markers from store or another file like .php which include function to add it.

Ext.define('Ext.ux.GMapPanel', {
extend: 'Ext.panel.Panel',
alias: 'widget.gmappanel',
requires: ['Ext.window.MessageBox'],
initComponent : function(){
    Ext.applyIf(this,{
        plain: true,
        gmapType: 'map',
        border: false
    });

    this.callParent();
},

afterFirstLayout : function(){
    var center = this.center;
    this.callParent();

    if (center) {
        if (center.geoCodeAddr) {
            this.lookupCode(center.geoCodeAddr, center.marker);
        } else {
            this.createMap(center);
        }
    } else {
        Ext.Error.raise('center is required');
    }

},

createMap: function(center, marker) {
    options = Ext.apply({}, this.mapOptions);
    options = Ext.applyIf(options, {
        zoom: 14,
        center: center,
        mapTypeId: google.maps.MapTypeId.HYBRID
    });
    this.gmap = new google.maps.Map(this.body.dom, options);
    if (marker) {
        this.addMarker(Ext.applyIf(marker, {
            position: center
        }));
    }

    Ext.each(this.markers, this.addMarker, this);
},

addMarker: function(marker) {
    marker = Ext.apply({
        map: this.gmap
    }, marker);

    if (!marker.position) {
        marker.position = new google.maps.LatLng(marker.lat, marker.lng);
    }
    var o =  new google.maps.Marker(marker);
    Ext.Object.each(marker.listeners, function(name, fn){
        google.maps.event.addListener(o, name, fn);
    });
    return o;
},

lookupCode : function(addr, marker) {
    this.geocoder = new google.maps.Geocoder();
    this.geocoder.geocode({
        address: addr
    }, Ext.Function.bind(this.onLookupComplete, this, [marker], true));
},

onLookupComplete: function(data, response, marker){
    if (response != 'OK') {
        Ext.MessageBox.alert('Error', 'An error occured: "' + response + '"');
        return;
    }
    this.createMap(data[0].geometry.location, marker);
},
afterComponentLayout : function(w, h){
    this.callParent(arguments);
    this.redraw();
},

redraw: function(){
    var map = this.gmap;
    if (map) {
        google.maps.event.trigger(map, 'resize');
    }
}

});

This is index php

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Stateful Array Grid Example</title>
<link rel="stylesheet" type="text/css" href="../../grid/extjs-4.1.1/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="../../extjs-4.1.1./examples/shared/example.css" />

<!-- GC -->
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=abcde&sensor=false"> </script>

<script type="text/javascript" src="../../extjs-4.1.1/ext-all.js"></script>



<script type="text/javascript"
        src="http://maps.googleapis.com/maps/api/js?libraries=geometry&sensor=true">
</script>

<!-- page specific -->

<script type="text/javascript" src="gmap.js"></script>
</head>
   <body>
  <h1>GMap</h1>
      <input type="button" id="show-btn" value="Gimme a Map" /><br /><br />


           </body>

How can i add markers from file or store? I’ve no idea. Please help me.

This is code from gmap.js

Ext.Loader.setConfig({enabled: true});
 Ext.Loader.setPath('Ext.ux', '../ux');
 Ext.require([
'Ext.window.*',
'Ext.ux.GMapPanel'
 ]);

 Ext.onReady(function(){
var mapwin;
Ext.get('show-btn').on('click', function() {
    // create the window on the first click and reuse on subsequent clicks
    if(mapwin) {
        mapwin.show();
    } else {
        mapwin = Ext.create('Ext.window.Window', {
            autoShow: true,
            layout: 'fit',
            title: 'GMap Window',
            closeAction: 'hide',
            width:450,
            height:450,
            border: false,
            x: 40,
            y: 60,
            items: {
                xtype: 'gmappanel',
                center: {
                    geoCodeAddr: 'Baku, Azerbaijan',
                    marker: {title: ''}
                },
                markers: [{
                    lat: 42.339641,
                    lng: -71.094224,
                    title: 'Boston Museum of Fine Arts',
                    listeners: {
                        click: function(e){
                            Ext.Msg.alert('It\'s fine', 'and it\'s art.');
                        }
                    }
                },{
                    lat: 42.339419,
                    lng: -71.09077,
                    title: 'Northeastern University'
                }]
            }
        });

    }
});
});

This code was taken from extjs 4 examples.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:40:36+00:00Added an answer on June 9, 2026 at 5:40 am
    1. Create a store to load your records into.
    2. Then create a load event for that store, and adapt the code below for your load event.

    My store’s load event.

    // Put the markers on the map after the store loads.
    onLoad: function(store, records, success, options) {
        var me = options.scope
        Ext.each(records, function(record) {
            this.addMarker(record.data);
        }, me)
    },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

enter code here Want to remove items from a Main list , but give
I'm programming Java in Eclipse IDE. Here is code I want to read file:
I'm using the code here and I want all the functions which call SDL
I want to download and save pdf file to internal storage. Here is code
Dynamically add textbox using jquery from the link above i want something like that,
I want to add a button on a view dynamically. Here is the code.
Here is my code : What i want is just to make scrollbar available
i just want to ask about my html code here, i have a bit
Just some example code here, but I have lists of strings that I want
Here's my code, what I want to do is to be able to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.