I work with Wax with Leaflet . I am creating a USA map by drawing state borders using GeoJSON using the L.GeoJSON flyer.
I can get everything that was set during map loading, but I need to configure the content in the pop-up windows after drawing the map. Here's a stripped down version of what I'm doing:
var gjStates = new L.GeoJSON(null, null); wax.tilejson(url, function(tilejson) { map = new L.Map('map').addLayer(new wax.leaf.connector(tilejson)).addLayer(gjStates); gjStates.on("featureparse", function (e) { if (e.properties && e.properties.name){ pops[e.id.substring(4)] = e.layer.bindPopup('<h4>Hello ' + e.properties.name + '!</h4>'); } }); for (s in usStateData) { gjStates.addGeoJSON(usStateData[s]); } });
Now everything draws well, pop-ups have a good continent, but then I want to change it later, and there is no way to refer to it. I saw in the source that bindPopup () returns 'this', which I thought was an L.Popup object, but turned out to be something else. So, for example, the following code will remove the active popup, and not the specific LPath object (object) I'm trying to get to.
pops['AK']._map._popup.setContent('I am ALASKA!');
Digging into the DOM with firebug, I also see that the pop-up content is set in an internal variable, and I can update it. However, updating this does not update the HTML, and there is no way to find out that Alaska has a key to 52. _layers [52] also does not have the setContent () method, which I would hope for if it were L. A popular object.
gjStates._layers[52]._popupContent = 'I am ALASKA!';
So, I was kind of stuck and did not find what I need. Is there a way to contact me and update the content for a specific pop-up on the map after the initial rendering?