I have contacts on my leaflet.js page where the image is determined by the state of the object they represent. For example, online and offline users on the network are green, while offline users are red. I do this by adding a class to divIcon and then manage the images with css.
Now I have added a cluster of clusters to my map. What I want to do is to determine the color of the cluster using most of the status βinside the cluster. My first idea was to do something like this:
this.markers = L.markerClusterGroup({
iconCreateFunction: function(cluster) {
console.log(cluster.getAllChildMarkers());
return new L.DivIcon({ html: });
}
});
But unfortunately, I cannot access the HTML elements from the array returned from getAllChildMarkers.
Anyone have any ideas on how I can do this? Or a way to get an HTML buffer element?
thank
EDIT:
( mapPin):
that.mapPins.org = L.divIcon({
className: 'org-div-icon',
html: "<div class='org-status "+ org.getGroupStatus() +"'></div>",
iconSize: [35, 35],
iconAnchor: [18, 17]
});
:
$(model.get('mapPin')._icon).find('.org-status').attr('class', 'org-status ' + model.getGroupStatus());
, _icon getAllChildMarkers, , , , .