5

I'm still trying to find the perfect Table of Contents sample for the ArcGIS Server JavaScript API 2.3. My previous question gave some hints but I now have a more specific question regarding checkboxes for layer control.

I need to provide a Table of Contents containing a variety of Tiled, Feature and Dynamic layers, which may be sourced from multiple ArcGIS Server instances. The TOC should allow the user to toggle individual layers on/off, and toggle multiple layers on/off simultaneously using a Group layer checkbox (ie, one high-level checkbox to control multiple lower-level layers).

This sample contains a nice Group layer control, but presumes that all the component layers may be switched on/off as VisibleLayers of a single Dynamic layer. This logic seems to be integral to the sample, so it doesn't look like a simple matter to modify it for feature and tiled layers. (Please let me know if I'm on the wrong track, and this sample would prove suitable)

The Legend Widget sample is more suitable as it simply switches any layer on/off (see the Natural Disasters panel on the right-hand side).

My question

How would I add a Group Layer control to the Legend Widget sample? eg, add a higher-level checkbox which will switch both Fire and Earthquakes layers on/off.

0

1 Answer 1

0

I haven't implemented it yet, but the sample at http://www.thejekels.com/dojo/Dijit_Tree_Chkbox.html looks suitable. This is what the TOC sample cited above uses. I'll try to customise it for my purposes

3
  • Did you ever find your ideal way to do this? I'm looking for a higher level grouping of the TOC as well...
    – user25976
    Jan 25, 2017 at 21:34
  • @user25976 I gave up on this, and in the meanwhile Esri released the Web AppBuilder, which has a pretty good TOC control. Jan 26, 2017 at 21:58
  • 1
    Does the webappbuilder allow an export to be used in a javascript app? we haven't gotten that going yet.
    – user25976
    Jan 27, 2017 at 3:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.