This content has been marked as final. Show 663 replies
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.
I looked at the demo of your TOC widget and found it as a great addition of you work to other widgets you have written. However, when I added it to my project, registered to module, and compiled, it gave an error on line 12 of layerAlpha.mxml complaining about not finding the WidgetCloseButtonSkin. Here is the error message.
1172: Definition com.esri.viewer.skins:WidgetCloseButtonSkin could not be found.
Yep, that is a bug in the uncompiled version. to fix it all you have to do is change line 12 to:
import widgets.TOC.WidgetCloseButtonSkin;I will get this fixed and release another version with the fix.
I was wondering how I might disable the more.... button that is in the map switcher. I would much rather our folks use the TOC widget to view layers when needed, and not have both areas available. Also i was wondering if it is possible to show the features (that are displayed on the second tab) with the layers?
Thanks for the help!
I don't know about showing the legend and visibility together but here is the answer to your first question.
In the config.xml file for your flexviewer, remove this line:
<widget right="20" top="55" config="widgets/MapSwitcher/MapSwitcherWidget.xml" url="widgets/MapSwitcher/MapSwitcherWidget.swf"/>
I also modified the portion of the code where Robert adds the widget to the config.xlm file to read:
<widget label="More Layers..." right="20" top="55"
This renames the widget to More Layers... to replace the code that you removed as per my instructions above and opens it the location of the old More Layers... button. I only have one Base Map in my project so this works for me. If you have more than one Base map this might cover up the base map selection buttons. After it is open, you can always move it or experiment with the numbers above to open it in a more convenient place.
Also, go to the TOCWidget.xml file in the \widgets\TOC folder and change the excluedeBasemapLayers from true to false and you can now turn off the Base Maps and/or change their visibility.
Or if you want to keep the basemaps in the togglebutton format that the mapswitcher provides than just edit you MapSwitcherWidget.xml to the below:
<?xml version="1.0" ?>
<layerlist label="More..." visible="false">
<!-- <excludelayer>TheLabelOfSomeLayerInMainConfig</excludelayer> -->
As far as adding the legend swatch to the tree, No you can not do that, Well yes you could if you are a good programmer, but I don't have any intention of doing that in my code.
Thanks for both options. I'll play around with it and see which will work for our needs.
as far as the legend option, not a big deal just wondering if it could be done painlessly. i'm no programmer by any means.
I have added your combined TOC/Legend widget to a project that I am working on, but I am having problems. I have built the widget from the source code. It is connected to an ArcGIS 10 Mapservice (Dynamic Layers). The TOC displays correctly, but when I click on the legend button, I just get a blank page. Even the legend label doesn't display. Have I missed something in the configuration?
The legend will only display layer that are in scale range to be visible and are checked to be visible in the toc. Also you might want to ensure that when you go to the rest services directory and to a specific layer that it contains drawingInfos.
Strange... Have you tried my dynamic legend widget? I would like to know if it is acting similarly?
I've just downloaded the dynamic legend widget now and installed it. Guess what - it's behaving exactly the same. Just a blank page. Must be something to do with how the mapservice is configured. Do I need to do anything special when I create the mxd? I have created a lot of customisations for my Flex viewer but I can't think of any that would conflict with your widgets.
I have not seen this before or have ever had anyone report this issue... Is your map services publicly accessible?
Unfortunately not. I'm stuck behind firewalls etc. I'll have a go at tracing the code through to see if I can get something a bit more definitive. An error message would be nice :-)
Are you using the source code version of the viewer? If so do you have the Flashplayer debug version installed on your machine?