Select to view content in your preferred language

Table of Contents - Legend Widget for FlexViewer 2.x

122371
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
DanDowning
Regular Contributor
Robert,

I had been using TOCWidget2.1.1 with flexviewer 2.1. I recently have upgraded to flexviewer 2.2 and TOCWidget2.2 (compiled_FV2.2). I use the map switcher to control basemaps and the TOC widget for operational layers. The new TOCWidget2.2 default does not include:
<excludeBasemapLayers>true</excludeBasemapLayers>


When I add that line the basemap layers still show up in the TOC widget.

Here is the code:
<configuration>
 <labels>
  <visibilitylabel>Layer Visibility</visibilitylabel>
  <legendlabel>Show Dynamic Map Legend</legendlabel>
 </labels>
 <servicelabel>Parcel Data</servicelabel>
 <servicelabel>Aerial Photography</servicelabel>
 <tocSettings>
  <expanded>false</expanded>
 </tocSettings>
 <excludeLayers>
  <excludeLayer mapservice="Parcel Data">68</excludeLayer>
 </excludeLayers>
 <excludeGraphicLayers>true</excludeGraphicLayers>
 <excludeBasemapLayers>true</excludeBasemapLayers>
</configuration>


Should I still be able to remove the basemap layers from the TOC Widget?

Thanks in advance, I've really enjoyed your submissions to the widget gallery.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Dan,

   Thanks for pointing this out. I have it fixed in Version 2.2.1 available now.
0 Kudos
DanDowning
Regular Contributor
Dan,

   Thanks for pointing this out. I have it fixed in Version 2.2.1 available now.


Thanks Robert! and thanks again for all your contributions to the flexviewer.
0 Kudos
EricVenden
Frequent Contributor
We had the TOC widget working in the 2.1 viewer and have recently upgraded to the 2.2 viewer.  We are using the latest TOC widget for the 2.2 viewer.  The TOC does not seem to work properly with grouped layers in a published map service.  There does not seeem to be a rhyme or reason to it's behavior.  Has anyone else seen this same result?  The map service has not changed from 2.1 to 2.2 viewers.

Thanks for your time.
Eric V
Gurnee, IL
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Eric,

   You will notice that the TOC Tree functions the same way the layer list widget and the mapSwitcher's operational layers does. ESRI made some changes to the toc component so that when you uncheck the parent of the group it does not automatically turn on or off all of it's children. I think that they are are on the right track with there code changes (BUT they definitely are not there YET).
0 Kudos
deleted-user-DeOizCraciXu
Deactivated User
Robert,

Since I'm running server version 9.3.1 I needed to figure out a way to disable the legend icon in the widget, and since it didn't make sense to have the toc icon all by itself I removed that as well.  The simplest way I found was to comment out the code that creates the buttons (see below).  I'm wondering 1) is that the best way to disable the buttons and 2) can you add a config option to disable the buttons for non-programmers?

/*
    wTemplate.addTitlebarButton(ICON_URL + "i_folder.png", visibilityLabel, showStateVisibility);
*/
//<----------Legend Work
    //Add the new legend button
/*
    wTemplate.addTitlebarButton(ICON_URL + "i_legend2.png", legendLabel, showStateLegend);
    legendAC = new ArrayCollection([]);
    removeMapListeners();
    addMapListeners();
    registerAllMapLayers();
*/   
//<----------End Legend Work


Thanks for ALL your contributions to the community!

Tim Berneman
Website Manager
Cerro Gordo County - Iowa
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Tim,

  I would suggest only commenting out the add button lines like below:
    //wTemplate.addTitlebarButton(ICON_URL + "i_folder.png", visibilityLabel, showStateVisibility);
//<----------Legend Work
    //Add the new legend button
    //wTemplate.addTitlebarButton(ICON_URL + "i_legend2.png", legendLabel, showStateLegend);
    legendAC = new ArrayCollection([]);
    removeMapListeners();
    addMapListeners();
    registerAllMapLayers();
//<----------End Legend Work

The way you have it, you are also commenting out the addMapListeners, registerAllMapLayers, etc. which initially would not be evident that it could cause you problems.

I will probably not add an option in the config as you suggest as you scenario is not a usual one. Most people would not be fooling with this widget for only the use of the TOC without the dynamic legend. At least I don't think.
0 Kudos
EricVenden
Frequent Contributor
I'm attempting to exclude layers from the TOC - not just in the legend, but in the actual layer listing.  Is the LegendexcludeLayer tag strictly for excluding a layer from the legend?  Additionally, I have set the following in my XML file:
  <LegendexcludeLayer mapservice="Parcels">0</LegendexcludeLayer>
  <LegendexcludeLayer mapservice="Parcels">4</LegendexcludeLayer>
  <LegendexcludeLayer mapservice="Parcels">6</LegendexcludeLayer>
Where Parcels is the name of the map service and 0,4,and 6 the endpoints for the specific layers I would like to remove.  Is this the correct syntax?

Thanks
Eric V
Gurnee, IL
0 Kudos
giuseppemolinario
Deactivated User
Hi Robert,

Thanks for this widget - I have seen it live and it is so far superior to what the new legend widget in v.2.2 does. It just makes a lot of sense, to have legend and layer switcher in the same place.

One thing I can't really figure out from documentation and forum is if your legend widget, or the one in v.2.2 distribution, support displaying legends of raster data.

I am also not a programmer, so unless this is a functionality that already exists, I will have to find some work around (drop legend widget altogether, try to go with the static displyed image on map solution - if i can get that figured out).

I'll try to install it and see what it does with my rasters - even if they don't work I would not know if the problem is the widget or if it  is the raster format/etc..

Thanks for your help,

Giuseppe
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Giuseppe,

  My legend definitely ignores rasters.
0 Kudos