World (0) (Grouplayer) `-> World Country (1) (Layer) `-> World Timezone (2) (Layer)
layer.setVisibleLayers([0]);
http://machine/ArcGIS/rest/services/grouped/MapServer/export?layers=show:0&...
Hi Axel,
Thanks again for your input. You have really helped me thus far.
I understand why we wouldn't have to show the feature layer, but I'm actually selecting features by using a freehand tool, so the layer needs to be turned on in order for the selection to work. I'm currently using MODE_ONDEMAND to perform the select.
So, my problem is when I turn off the layer in the TOC, the layer is still turned on the feature layer). How do I control the feature layer in the TOC? Is it possible? I know the layer in the TOC is part of the basemap, as I created it in the grouped.json file.
In total, I'll probably have around 6 or so feature layers, so this is an important part of my application. The user needs to have the ability to turn the feature layers on and off, and be able to select the feature layers if they are turned on.
Thanks again,
Andrew
We have implemented the TOC layer control and are currently saving the state of the visible layers to a database. We then retrieve the visible layers if a user presses a load button and update the map based on their saved view.
We are using a dynamicmapservice and we pass the array to the setVisibleLayers of the service after the load. This updates the map correctly, however, all of the checkboxes in the TOC remain checked. Is there a preferred way of updating the TOC checkboxes?
{
identifier: 'name',
label: 'name',
items:
[
{
name : 'Gates',
type : 'layer',
id: 0,
visible: true,
children:
},
{
name : 'Fences',
type : 'layer',
id: 1,
visible: true
},
{
name : 'Railways',
type : 'layer',
id: 2,
visible: true
},
{
name : 'Primary Roads',
type : 'layer',
id: 3,
visible: true
},
{
name : 'Roads - Other',
type : 'layer',
id: 4,
visible: true
},
{
name : 'SWMUs',
type : 'layer',
id: 5,
visible: true
},
{
name : 'SWMU Extents',
type : 'layer',
id: 6,
visible: true
},
{
name : 'Lakes',
type : 'layer',
id: 7,
visible: true
},
{
name : 'Buildings/Structures',
type : 'layer',
id: 8,
visible: true
},
{
name : 'Berms',
type : 'layer',
id: 9,
visible: true
},
{
name : 'Property Boundary',
type : 'layer',
id: 10,
visible: true
}
]
}
worldgroupedModel = new tmpdir.CheckBoxStoreModel({
[...]
rootLabel: 'Your text here...',
[...]
});