I want to exclude several of the sublayers in a ArcGISDynamicMapServiceLayer in the table of contents (TOC). IS this possible and if so where does the happen?
Take a look at this post, which gives an example on how to hide a sub layer dynamically. You can also hide them when the TOC is initially built. It looks like this is possible using a 10.0 server, also.
Haven't tested with TOC widget., but I believe you would use ImageParameters.
Here is a sample:
imageParameters.layerOption = ImageParameters.LAYER_OPTION_SHOW
you would use
imageParameters.layerOption = ImageParameters.LAYER_OPTION_EXCLUDE
I did try that. However, the sublayers still show up in the Table of Contents. I think that is for display in the map.
That is fantastic! Exactly what i was looking for. Thank you!
One note of caution. If you have sub layers within a group layer, you have to include the group layer in the layer ids. You'll get some unexpected behavior if the group layer is excluded.
I am just noticing that now. One of the layers still draws even when using the imageParameters in conjunction with the other code for the TOC.
The problem is that one of the sublayers is checked on. I can make it so that its hidden using the imageParameters and hide it from the TOC, but when i turn on another layer it becomes visible. This isnt my service so i cant modify it on the backend. How would i uncheck it by default?
Use the setVisibleLayers method on the layer to specify which sublayers are initially visible.
Oh yeah! i forgot about that. Thanks again.
Which "TOC widget" are you referring to?
Retrieving data ...