Legend_HideLayer

1933
4
04-29-2014 03:39 AM
IvoSajer
New Contributor
Hello, i would like to hide some layers from my legend, i know ID´s of layer which i want hide, but i dont know how to use LayerInfo: HideLayers
This is my legend, please can you give me some example how to hide layers, thanks

var legend = new Legend({
      map: map,
    }, "legendDiv");
    legend.refresh([{layer:dynamicMapServiceLayer, title:'Vodstov '}]);

    legend.startup();
0 Kudos
4 Replies
TimWitt
Frequent Contributor
Ivo,

this thread should help you. Just tell the Legend which layers to show and it won't show the ones you don't want to show.

Tim
0 Kudos
JeffPace
MVP Alum
add another vote for a hideLayer method.  I have alot of services.  I would love to hide one or two from showing up in the legend without having to hardcode the dozens of others.
0 Kudos
TimWitt
Frequent Contributor
Ivo and Jeff,

see this post. The posted fiddle should help.

Tim
0 Kudos
IvoSajer
New Contributor
Thanks for your answers, its working.
0 Kudos