Grouping layers in JavaScript Basic Viewer's Table of Contents template on ArcGIS.com

593
1
01-03-2013 06:03 AM
KevinMacLeod1
Occasional Contributor III
Hi all, I searched and didn't see this question or anything like it. Apologies if this is a redundant post!

I am creating a javascript site, currently based off of ArcGIS.com and the JS Sample Basic Viewer template.

We are converting a Flex site to Javascript. I'm new at this. One nice thing I noticed about the Flex site is it groups REST layers together, as they are organized on the server. It creates a hierarchical folder tree and you can EITHER click a group to turn all sublayers on, or you can expand it with an arrow and the list drops down, where you can turn on one or more layers.

In this way it is "smart". When I add them to ArcGIS.com if I point to the group of layers they all draw at once. Actually, on the ArcGIS.com website it also does exhibit this behavior. However, it does not do this on the locally hosted viewer when I browse to it on as it???s stored on my machine (when it loads our copy hosted here, and ???played??? in Visual Studio)...it doesn't expand to allow turning individual layers off. When I add them each individually, they all appear in my Table of Contents widget in the JS Viewer, making quite a long list of layers. 

Is there a way to make the Sample Viewer layer list widget behave as the Flex one does, on our locally-hosted site based on the JS Basic Viewer, out of the box? Or if not, has someone already created custom code to do this or is there a straightforward way to achieve this?

Thanks all.
0 Kudos
1 Reply
AimeeMandeville
New Contributor II
we are also trying to do the same thing.  In the flex viewer we have the map service (Wind Speed) which is made up of sub-layers showing various wind-speed layers.  (behaving like a grouped layer in ArcMap)  When adding these same services to ArcGIS.com viewer they behave as they do in the flex viewer, however we are trying to put the viewer into the Basic Viewer Application.  When this is done, the sublayers are no longer accessible.   Any thoughts or suggestions on this? 

Thanks for your input.

Aimee Mandeville
0 Kudos