Code Gallery
Table of Contents (TOC)
|
This sample provides a Table of Contents (TOC) Flex component for managing the layers of a Map. The TOC displays the hierarchy of layers within ArcGIS Server and ArcIMS map services, and it allows toggling of layer visibility.
|
|
Report Inappropriate Content: This Code Gallery is intended for the free exchange of code related to ESRI software products. Let us know if this entry is inappropriate (e.g., a download for a commercial product).

Thanks posted by Abdusabri on Oct 30, 2008 12:35 AM
Great work, it worked for me, i had no problems using it in my application. It is really nice, i like the feature of toggling the visibility of individual layers. Good job
good work posted by EJAY_L on Nov 25, 2008 1:02 PM
Thanks a lot. I can't wait to try it.
Updated TOC with bug fix posted by tomhill80 on Dec 04, 2008 11:50 AM
I have posted a new version of the TOC component. Please download the latest zip file if you are using it in your applications. Specifically, the TocMapLayerItem.as file has been updated to include a workaround for bug #NIM040263.
Great job posted by ruprict on Dec 08, 2008 11:42 AM
Just plugged it in and it works beautifully. Great work, mate!
TOC background color posted by holocron on Dec 11, 2008 4:25 PM
Nice tool. It's exactly what I need and saved me extra coding. However, I don't seem to have any control over the background color or transparency of the panel itself through the TocGroupsSample code. The background is always white and the alpha always 1. I need to be able to control these properties for the TocGroupsSample panel. I can set these properties with no problems using the regular TocSample code. But I prefer to use the TocGroupsSample code. Can I set these properties for TocGroupsSample or is it hard coded to background of white with an alpha of 1?
TOC background color posted by holocron on Dec 12, 2008 8:28 AM
I resolved the issue. I just added the Tree component to my style.css file and set the properties there and now the TOC has the background and alpha that I need. Thanks again for providing the tool!
Reorder bug posted by ruprict on Dec 22, 2008 1:30 PM
I think your onLayerReorder may have a bug (it substracts 1 from the add back index, which means you can't ever add a layer to the end or a reorder). I am working on being able to drag/drop reorder the layers, and am pretty close. I can send you the code if you wanna review/make sure I am not high. glenn(dot)goodrich(at)gmail.com
Updated TOC with new features posted by tomhill80 on Jan 09, 2009 11:21 AM
I have posted a new version of the TOC component. Please download the latest zip file if you are using it in your applications. The changes: (1) TOC and TOCAccordion now have a hideTopLevelItems property. Set to "true" to hide the top-level map service tree nodes and show only the child layers of a map service. (2) TOC and TOCAccordion expose styles for customizing the tree node icons. The styles are "layerIcon", "groupLayerIcon", and "mapServiceIcon". For help on embedding your own icon images, see http://livedocs.adobe.com/flex/3/html/embed_1.html
Loop through layers posted by padesso on Feb 12, 2009 3:52 PM
Can anyone give me some guidance on how to loop through the layers in the table on contents so I can bind to a ComboBox elsewhere in my application? Any help here would be very much appreciated! Patrick
Toc Symbols posted by m.megahed on Mar 10, 2009 5:10 AM
Do you have any idea about adding layer symbols to the toc leaves? also is it possible to show a context menu on each node to "zoom to layer/highlight layer" functionality?
Map refresh posted by TomGeo on Jun 05, 2009 6:51 AM
First of all... This is really great work. It works almost like a dream. Almost because I have an issue with the update of the map. The service I created contains a couple of layers arranged in two group layers. Now, I can turn the MapServiceLayer on and of but it doesn't matter if the group layers are unchecked or not, the still show the same data. Am I just missing a setting or so? Thanks for the great work, Thomas
Checkbox click event. posted by pjohnson on Aug 24, 2009 1:08 PM
Is there a way/event I can capture when a user toggles the visibility of a layer in the TOC with the checkbox?
Question for TOM posted by Neeraj on Jan 20, 2010 11:26 AM
How do I make the checkbox appear dark when the layer is not visible at the Map scale? For pjohnson, if you still need code for what you are trying to do let me know, I have done this already. Thanks
Hide a layer in the TOC posted by jeffperkins on Jan 28, 2010 4:13 PM
Tom, nice work with the TOC. Is there a way to not have a layer (that's in your
Problems when checking multiple layers posted by vdkamp on Jan 29, 2010 12:59 AM
Thanks for sharing this component, it saved me a lot of work. But I have a problem: when checking multiple layer/layer group items(already checking a new item before the map display has been updated from first selection) the synchronisation between map and TOC sometimes get lost: a layer selected in the TOC doesn't appear on the map, when toggling a layer in the TOC a different layer on the map is toggled. A simple solution for me would be the possibility to disable the TOC while in process of updating the map. Is that easy to do?
If you would like to post a comment, please login.