TOC Expand 2.0

3576
9
08-03-2010 02:20 PM
MatthewLawton
Occasional Contributor
Okay, I junked my 1.3 site and have downloaded the 2.0 Flex Viewer template. I have my map services plugged in and I am starting fresh. The config file is a bit different. I see that the "Live Maps" from the 1.3 template are now under the "More.." button.

I have successfully added my dynamic layer under the operationallayers tag in the config.xml and the service shows up under the "More.." button. I now want my map service under "More..." to be expanded to show all of the layers available for toggling. Would that be in the LayerListWidget.mxml?
Tags (2)
0 Kudos
9 Replies
RobertScheitlin__GISP
MVP Emeritus
Matthew,

   Just add this to the MapSwitcherWidget.mxml:

//Add this import
import com.esri.viewer.components.toc.tocClasses.TocMapLayerItem;

//Add this to the very end of the init function
callLater(expandTOC);

//Add this new function
private function expandTOC():void
   { 
    toc.openItems = toc.dataProvider.source;
    for each(var item:TocMapLayerItem in toc.openItems) {
     if (item.isTopLevel()){
      toc.expandItem(item, true);
     }
    }         
   }
0 Kudos
MatthewLawton
Occasional Contributor
Well done, Robert! Thanks for not giving up on me. I will stop complaining now. 😄
0 Kudos
DanielOchoa
Occasional Contributor
Matt,

You said you were able to add your dynamic layer under the operationallayers tag....I can't seem to get mine to work.  I'm wondering if you could show/tell me "how" you added it - heres mine:

<operationallayers>
<layer label="stuff" type="dynamic" visible="true" alpha=".5" url="http://severname/arcgis/services/test_maps/stuff/MapServer"/>
</operationallayers>

The service is working in ArcGIS server (as stated above - its a dynamic service, not tiled), as I can preview it in ArcCatalog, and its in the same projection as the basemaps (WGS 84 Web Mercator). It appears in the "more" box with the other services, but not on the map itself.   Could it be a permissions issue for the folder itself in the IIS? I'm stumped, and also very new to the SFV 2.0 (I never tried using 1.3). I even tried the IP instead of server name, no go. 

Thanks!
0 Kudos
DanielOchoa
Occasional Contributor
Robert,

How does one edit an mxml when there isnt one there? There's one SWF and and one XML...or is the mxml the uncompiled swf?

Thanks
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Daniel,

   Yes a mxml file is a uncompiled swf. You need to be sure you downloaded the source code for the viewer and not just the compiled version.

Make sure you sign in using your global id
This is the Viewer's source code link:

http://www.arcgis.com/home/item.html?id=3f6a0bfee48949a88df50bf7686ec72a
0 Kudos
MatthewLawton
Occasional Contributor
Daniel, my map service just seems to work. It is also dynamic and takes a few seconds for the layers to render, but they do show up. Are you sure the primary check box is on for the service before you toggle the individual layers? I have mine not visible by default so I have to make sure to do this. Do you have any permissions set for this service that would cause it not to appear?

This is how I have my service referenced in the config.xml:

        <operationallayers>
            <layer label="Facilities and Infrastructure" type="dynamic" visible="false"
                preload="true"
                   url="http://<server>/ArcGIS/rest/services/EOCWebMercator/MapServer?token=xxx"/>
        </operationallayers>
0 Kudos
CPennington
New Contributor


<operationallayers> 
<layer label="stuff" type="dynamic" visible="true" alpha=".5" url="http://severname/arcgis/services/test_maps/stuff/MapServer"/>  
</operationallayers> 



Thanks!


you're missing the "rest"?

<operationallayers>
<layer label="stuff" type="dynamic" visible="true" alpha=".5" url="http://severname/arcgis/rest/services/test_maps/stuff/MapServer"/>
</operationallayers>
0 Kudos
DanielOchoa
Occasional Contributor
Matt,

Thanks for answering my post.

I think alot of folks like me are coming from a different viewer config (in my case, web adf/.NET environment/C#) and are not familiar with some of the simpler yet critical setup issues.  In my case, I wasnt using REST services in my Web ADF viewer, so I did not have my REST WebServices set up correctly (or at all!).  After researching, thats what I traced my problem to.  I re-ran the web application post install and fixed my REST config file. Once this was done, everything worked fine.

Here's a good link regarding how I solved my issue:

http://forums.esri.com/Thread.asp?c=158&f=2399&t=271160
http://forums.esri.com/Thread.asp?c=158&f=1696&t=293637
http://forums.esri.com/Thread.asp?c=158&f=2421&t=262557

and this guide should be on your server:

C:\Program Files\ArcGIS\DeveloperKit\Help\REST\gettingstarted.html


Making progress - thanks for the help!

Robert - thanks for your help as well!
0 Kudos
karenvolarich
New Contributor III
Anyone tried removing the live layer widget to the toolbar instead of the mapswitcher?  You know creating a separate widget not attached to the basemap?

Thanks,
Karen
0 Kudos