0

So here's the situation: I have a class called Map which is a child of GMapPanel. I want to place markers on the map based on data loaded into MapIncidents via JSON. Now, I know I can't do that during the initialization of Map because the JSON request inside MapIncidents* is asynchronous and therefore not ready yet. So instead, I added a listener to Map inside Incidents so that when the data had loaded it would execute a method inside Map that would add markers to the map. To make things extra complicated, I'm also using a class called markerclusterer to add clustering to the map when zoomed out.

Now I have the code doing all this, BUT for some weird reason it appears to be adding double markers, i.e. the clustering says that there are 2 markers right on top of each other.

Don't know what I'm doing wrong, so I would appreciate a little help here. I'll stick my code in some pastebins.

Map.js (view) -> http://pastebin.com/9xtBYYKt

MapIncidents.js (store) -> http://pastebin.com/uJnHkBSm

Incidents.js (controller) -> pastebin.com/tjEc2xT5

GMapPanel.js (slightly modified) -> pastebin.com/W7LTxV9s

markerclusterer.js (taken from google amps) -> pastebin.com/SiUkLhW2

Incident.js (model)

Ext.define('SF.model.Incident', {
    extend: 'Ext.data.Model',
    fields: ['incident', 'lat', 'lng']
});
gordon
  • 824
  • 1
  • 9
  • 18
  • So where exactly do you see markers doubled? After you load them from the store or some place else? – sha May 23 '12 at 18:52
  • @sha - I'm seeing double on the actual map. I think it might be something to do with cache, because when I fired up chrome today it was all fixed, then I went and changed the some of the locations in the json file and suddenly I've got doubles again. Basically, should only see 12 markers, but its acting as if there's 24. In the dom only 12 objects exist. – gordon May 24 '12 at 15:34
  • just out of out of curiosity, have you ever refactored your code to support the MVC pattern? accessing the store in the view is definitely not MVC-like – lightxx Aug 23 '12 at 09:40
  • Sorry for bumping such a old topic.. Just wanted to ask you if you solved your problem? I am running into same issues too! Would appreciate if you could suggest the solution! – First Blood May 29 '13 at 00:34

0 Answers0