Select to view content in your preferred language

Table of Contents - Legend Widget for FlexViewer 2.x

122405
664
12-01-2010 07:30 AM
RobertScheitlin__GISP
MVP Emeritus
All,

Here is the next in my line of widgets for the FlexViewer 2.x.

The legend portion of this widget is the same code as my dynamic legend widget so,

IT IS FOR ARCGIS SERVER 10 OR GREATER ONLY

This is just a simple TOC Widget that includes my dynamic legend component.
This widget also includes my enhancement for map service transparency,
right click context menu for zoom to make layer visible, and my scale
dependent renderer for the TOC checkboxes.
Tags (2)
0 Kudos
664 Replies
BenScott1
Deactivated User
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




0 Kudos
RobertScheitlin__GISP
MVP Emeritus
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.
0 Kudos
GISDev1
Deactivated User
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






You might want to give this a shot if you are still seeing this issue. No guarantees it won't break your entire application or anything, but it fixed the problem for me.

This is how I fixed this in the createChildren function in TocMapLayerItem.as found in Robert's TOC Widget v 3.3.0 (5/6/13) code here: /widgets/TOC/toc/tocClasses/TocMapLayerItem.as around line 912:

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
     
0 Kudos
GISDev1
Deactivated User
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.


Thanks for keeping us updated on your development plans for your awesome TOC widget Robert. Much appreciated. I am looking forward to seeing the Enhanced LayerListWidget.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
All,

  This widget has now been retired. For Flex Viewer 3.4 and above start using the Enhanced Layer List Widget:

http://www.arcgis.com/home/item.html?id=58d9bb5693c94918a3934781d7234d18
0 Kudos
BenScott1
Deactivated User
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.


Thanks Robert - much appreciated.
0 Kudos
SpatialNinja
Esri Regular Contributor
Hi Robert,

I am having an issue with the settings in the XML file.  I am using the 3.5 complied version, and I have changed the visibility label and I have chosen to not collapse the legends so that the symbology is showing and the user does not need to expand everything, but my changes in the XML are not reflected in the widget.  Do you know what that is?  Thanks.

[ATTACH=CONFIG]28138[/ATTACH]
Solutions Engineer | Spatial Ninja  | GIS ️ | Telecommunications
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
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.
0 Kudos
SpatialNinja
Esri Regular Contributor
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.


I don't want everything expanded, just the legend/symbology.  Also, I changed the widget label to 'Legend,' but it still says 'Layer Visibility.' Thanks.
Solutions Engineer | Spatial Ninja  | GIS ️ | Telecommunications
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
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.
0 Kudos