Jeff,However, curious if you still have the issues if you set the mapswitcherwidget.xml layerlist tag to false? <layerlist visible="false"> since the TOC widget is not designed to run with it set to true?
It is your responsibility to disable the layerlist portion of the MapSwitcherWidget or eMapSwitcherWidget by setting the <layerlist visible="false"> Also ensure you do not use the TOCWidget with the LayerListWidget.
* Whole map services AND/OR INDIVIDUAL layers can be excluded from the TOC.
Hi Robert - again thankyou for a great widget. I am experiencing an error which a few others have reported, in that I am getting a blank table of contents on first load. When this occurs all other widgets in the viewer cease to function as well. The problem reappears when the viewer is first opened or straight after the browser cache has been cleared. Once the page is refreshed it works fine. I have done some testing with different services etc and have found that the problem occurs with as few as two dynamic services which have 7 layers each if there are popups configured for each sublayer. When no popups are specified the toc works fine with a large number of dynamic services. It also seems to work fine with tiled services regardless of number of services and popups. Specifying a large legend timeout time in the config doesn't seem to fix the problem. The normal layer list widget configured for the same services etc works ok. Cheers,Ben
private function createChildren():void { children = null; var layerInfos:Array; // of LayerInfo var visibleLayers:Array; var li:LayerInfo; if (layer is ArcGISTiledMapServiceLayer){ layerInfos = ArcGISTiledMapServiceLayer(layer).layerInfos; }else if (layer is ArcGISDynamicMapServiceLayer){ var arcGISDynamicMapServiceLayer:ArcGISDynamicMapServiceLayer = ArcGISDynamicMapServiceLayer(layer); if (arcGISDynamicMapServiceLayer.visibleLayers == null) { //Added if check for bugfix trace("found null"); } else { arcGISDynamicMapServiceLayer.visibleLayers.addEventListener(CollectionEvent.COLLECTION_CHANGE, visibleLayersChangeHandler); } _visibleLayersChangeWatcher = ChangeWatcher.watch(arcGISDynamicMapServiceLayer, "visibleLayers", visibleLayersChange); _dynamicMapServiceLayerInfos = arcGISDynamicMapServiceLayer.dynamicLayerInfos ? arcGISDynamicMapServiceLayer.dynamicLayerInfos : arcGISDynamicMapServiceLayer.layerInfos; //Added per commit on GH if (_isVisibleLayersSet){ ....all code is the same for the rest of the createChildren function
Ben, Thanks for narrowing down the issue to DLs with popups configured for sublayers. It is likely that I will be retiring this widget in lieu of an enhanced LayerListWidget soon as I have added most of the TOCWidget features to esris LayerListWidget and it has better response time for rendering and does not require some of the work arounds in code that I had to do for the TOC Widget. I will let the community know one way or another.
Patrick, If you need everything expanded at startup then you need to set the expand tag to true and its everything attribute to true as well.
Patrick, There is NO option to have the legends expanded and not thier parent nodes. You need to check if you are pointing to the correct xml file in the main config.xml and that you have cleared your browsers cache.
<expanded everything="false">true</expanded> <collapselegends>true</collapselegends>
<labels> <title>Legend</title> <expandall>Expand All Layers</expandall> <collapseall>Collapse All Layers</collapseall> <zoomtomakevisible>Zoom To Make Visible</zoomtomakevisible> </labels>
Patrick, Something is definitely off then. The collapselegends tag specifies whether the legend swatch is visible by default when the parent node is expanded. So here is an example of how to expand all nodes without their legends being visible: <expanded everything="false">true</expanded> <collapselegends>true</collapselegends>If you set the everything attribute to true this overrides the collapselegends tag.I found an bug in the widget and the visibilitylabel is not used. In version 3.5 add a title tag instead. <labels> <title>Legend</title> <expandall>Expand All Layers</expandall> <collapseall>Collapse All Layers</collapseall> <zoomtomakevisible>Zoom To Make Visible</zoomtomakevisible> </labels>
<excludelayers> <excludelayer mapservice="mcdonough_highway">2,3,5</excludelayer> </excludelayers>
<excludelayers> <excludelayer mapservice="mcdonough_highway">1</excludelayer> </excludelayers>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.