Select to view content in your preferred language

LayerList legend not updating correctly

3400
3
12-02-2015 01:30 PM
KenBuja
MVP Esteemed Contributor

The LayerList widget in 3.15 has some additional functionality, including showing the legend. However, the legend doesn't get updated when the checkbox on a layer is clicked. It will only update when the map is zoomed in or out. It will not update if the map is panned.

JS Bin - Collaborative JavaScript Debugging

Tags (1)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Ken,

   I am seeing the same thing. Are you going to call this into Tech Support?

0 Kudos
KenBuja
MVP Esteemed Contributor

Yes, I have called it in. Currently, their work-around is to use the toggle event to refresh the widget when a layer is toggled. Unfortunately, this has the side effect of collapsing the LayerList widget every time you toggle a layer.

myWidget.on("toggle", function (){ myWidget.refresh(); });

This doesn't have any effect on the startup issue, though. I tried refreshing the widget when the load event is fired, but that leaves the legend totally empty.

layerlist.png

KenBuja
MVP Esteemed Contributor

This has been fixed in 3.16

ENH-000092811: Layerlist widget now updates the legend on the toggle of the sub layers.

0 Kudos