AnsweredAssumed Answered

Legend Widget -- Layers added dynamically

Question asked by gknight on Jan 29, 2013
Latest reply on Jan 31, 2013 by gknight
Hi all,

Are there any examples out there that illustrate the logic associated with using the Legend Dijit with layers that are added to the map after the map is instantiated?  All the examples seem to focus on displaying legends for layers that are known at runtime.  In my application the layers are not necessarily known at runtime.  Specifically, I am having some difficulty with the logic associated with

1) initializing the legend at runtime when its possible that no operational layers are loaded

and

2) later refreshing (or starting) the legend with (ad-hoc) operational layers that are added after the map is initially loaded

Are there any examples out there of this nature?  If not, could someone provide an outline of the logic necessary here?

Many thanks,
Greg

Outcomes