I'm developing a Table of Content to turn on\off layers on map using javascript \ dojo-AMD sdk. I found a few places on the internet that shows ways. Nothing that is making complete sense to a newbie. Has anyone done this in a way that makes sense?
Solved! Go to Solution.
Kind of. If you turn off a layer group with say 3 of 6 layers visible and then turn it back on all layers of the group are visible.
Matt,
Can you provide anymore info in this possibly being added to the ArcGIS JavaScript API? When? What functionality might it have?
Thanks
Simon
I see with the latest JS API release 3.14 there is now a LayerList widget in the API in Beta.
@ ESRI developers:
There is a bug: It does not uncheck sublayers if you uncheck the group.
(as detailed here WebApp Builder TOC bug and About upcoming JSAPI 4.0 beta 1 )
You should also at least have an option to make it collapse the list of layers. (roll them up). And gray out scale dependent layers beyond scale.
In other words, make it like @Nianwei's AGS JS TOC.
It would be useful to be able to exclude layers from a service, also.
Ken, I second this. By the way, thank you for your past TOC examples, they were very helpful.
If we are going for a wish list here, it would also be nice to have at a bare minimum these features in the new LayerList;
-ability to alter transparency of each service
-included legend
-ability to move services up/down
I think we'd like to keep it simple and make sure it's intent is not for editing a map but for performing simple layer adjustments as a viewer.
Keeping a legend out would be best as we have a legend dijit for that and combining the two makes a complicated, unfriendly user interface.
Good suggestions so far:
- Layer transparency slider.
- Excluding specific sublayers.
- Greying out scale dependent sublayers. (parent layers already do this)
- Collapsable option or sublayers collapsed when not visible.
Keep em' coming
While altering layer transparency isn't built in to the class, it does give you the option of adding your own slider with the "content" object in the layers property. You'll have to code its functionality
var myWidget = new LayerList({ map: map, layers: [{ layer: atlasLayer, id: "Atlas layers", content: "horizontalSlider", subLayers: true }], }, "layerList");
<div id="horizontalSlider" style="width:80%;" name="horizontalSlider" data-dojo-type="dijit/form/HorizontalSlider" data-dojo-props="value:6, minimum: -10, maximum:10, discreteValues:11, intermediateChanges:true, showButtons:false"> </div>