Where can I find an example of a Table of Contents control to plug into the ArcGIS Server JavaScript API 2.3? Ideally it should support feature/dynamic/tiled layers; show symbology; and allow grouped layers. Transparency and zoom-to functionality would be ideal.

The Esri samples page is strangely lacking in any TOC examples - the nearest example is the extremely rudimentary Toggle Layer Visibility.

Answers to Kirk's question show a few templates but they don't contain a decent TOC. The ROK sample is close but doesn't show symbology or support feature layers (as far as I can see).

The TOC on the ArcGIS.com My Map viewer is almost exactly what I need. Has anyone managed to build something similar, or get this TOC working locally?

enter image description here

  • Something to consider: blog.davebouwman.com/2011/01/05/… Jun 28, 2011 at 16:20
  • Derek, I agree that a focussed app is preferable - but sometimes you just need to concede to the user's expectations and provide some fine-grained layer control. The Stamen maps he mentions are awesome, but they each do one very specific thing (often as a proof-of-concept). A paying client often wants a single app which can be used by all staff, and a TOC makes this feasible. It's not so much of a compromise to add a sewer network or some census layers and have them off by default, if it means a whole extra division can suddenly use your site. Jun 28, 2011 at 23:05
  • I have to agree with Stephen on this one. While there are times where a TOC shouldn't be used (ie. public facing apps), in many cases what my users are asking for cannot be done without building a TOC (especially when they are actually asking for one). I would consider these people to be "Professional Users". They aren't a GIS professional but require more than what should be offered to the general public.
    – Mike Long
    Aug 31, 2011 at 15:57

6 Answers 6


Is this what you are looking for? I found it by searching the Code Gallery page on the ArcGIS API for Javascript Resource Center.

  • looks promising - I'll give it a go and report back whether it works. Thanks! Jun 28, 2011 at 23:08

There's a new TOC sample called Table of Content/Legend Widget for JavaScript API by Nianwei Liu, which fits the bill almost perfectly. It doesn't (seem to) allow feature layers but this is a compromise I can live with since it answers the other requirements very well.

enter image description here


Here is a link to another example. This TOC/Legend is automatically generated by the layers in the MXD.


It is part of one of the printing with ArcPy samples located below.



  • provided 1) link seems to be broken
    – Krystian
    Jan 8, 2013 at 15:05

There is a Table of Contents [TOC] Layer with Symbology with ArcGIS Javascript 2.3 is here at the bottom (in the the Footer)


  • not exactly what I was looking for, but it's a nice approach to a TOC (which would probably work well on a tablet, with click on/off toggling). Thanks Jun 28, 2011 at 23:11

I asked this question nearly 3 years ago - Esri have recently released the ArcGIS Web AppBuilder.

This contains an out-of-the-box Layer List widget, which is effectively a Table of Contents. It has some nice functionality built in, and the WAB framework handles the interaction with the current map layers.

enter image description here

Widgets are editable, so you should be able to extend or modify this as required.


In the years since I asked this question, there have been many changes in the ArcGIS Server JavaScript API. The latest version 4.x now contains an out-of-the-box LayerList widget.

It doesn't contain every item in my wish-list but is a great place to start.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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