Select to view content in your preferred language

NLiu's Table of Contents(TOC)/Legend widget and Visibility States

4115
27
Jump to solution
03-09-2012 04:21 AM
AlexDeVine
Occasional Contributor
Hi Forum,

I am using NLiu's TOC Widget in a web application I am developing: http://www.arcgis.com/home/item.html?id=9c43bdf76a23452ba1d95684f7cd76d8

It is a great widget and it is working great, except one thing... I also have an Identify task that I would like to be able to only have work on the visible layers, but as the widget is handling the visibility, it has effectively "blackboxed" the layer visibility state for me. I was hoping to be able to obtain an array from the TOC widget and feed that to my identify task so that it had the latest info on what should be returned, but I am stymied. Any tips?

Thank you, in advance, for any help.

Alex DeVine
University of Georgia
0 Kudos
27 Replies
ZhujingXia
Frequent Contributor

It worked.

What happened is that the TOC window is small for 3 map services(each has a lot of layers) I have to make all the layers not show in the toc windows, this way there is enough room to show the 3rd map service. Do you know where can make the layers not show in the TOC windows by default?

thanks

zhujing

>>> Ken Buja <geonet@esri.com> 9/26/2014 9:51 AM >>>

Ken Buja replied to the discussion

"NLiu's Table of Contents(TOC)/Legend widget and Visibility States"

To view the discussion, visit: https://community.esri.com/message/425287?et=watches.email.thread#425287

0 Kudos
KenBuja
MVP Esteemed Contributor

In your layerInfo, you can set the collapsed to true. You'll have to turn off the visibility of the layers in one or more of the services to collapse them.

Also, have you thought of putting the TOC in a container that can scroll?

0 Kudos
ZhujingXia
Frequent Contributor

Oh Ya, could you let me know how to make the TOC container scroll?

>>> Ken Buja <geonet@esri.com> 9/26/2014 11:22 AM >>>

Ken Buja replied to the discussion

"NLiu's Table of Contents(TOC)/Legend widget and Visibility States"

To view the discussion, visit: https://community.esri.com/message/425370?et=watches.email.thread#425370

0 Kudos
KenBuja
MVP Esteemed Contributor

This Fiddle shows the TOC in a scrolling container

0 Kudos
ZhujingXia
Frequent Contributor

Ken,

Could you point out more detail about where I i should set up this layerinfo? is that in the TOC.js file?

zhujing

>>> Ken Buja <geonet@esri.com> 9/26/2014 11:22 AM >>>

Ken Buja replied to the discussion

"NLiu's Table of Contents(TOC)/Legend widget and Visibility States"

To view the discussion, visit: https://community.esri.com/message/425370?et=watches.email.thread#425370

0 Kudos
KenBuja
MVP Esteemed Contributor

My previous post has a link to the layerInfo documentation. You apply it when you instantiate the TOC. See the Fiddle I have set up in the other previous post.

0 Kudos
ZhujingXia
Frequent Contributor

Is there a way to use identifyTask with Nliu,s TOC for multiple map services? Is there a way to know which map service it is using for identify? I could hard code to let it know which map service is going to use, but like to see is there a way to know which map service going to use  from the map or TOC automaticall?

     identifyParameters.layerIds = dynamicMapServiceLayer.visibleLayers;

     var identifyServer = cfg_identifyServerURL.checkAppendToken();

      var identifyTask = new IdentifyTask(identifyServer);

0 Kudos
ZhujingXia
Frequent Contributor

Nliu,

I used your toc widget for 4 map services, When do the identify I could assign only one map service with

   identifyParameters.layerIds = dynamicMapServiceLayer.visibleLayers;

Is that possible to know the map service automatically based on the user clicked on the map?

Thanks

Zhujing

0 Kudos