Toggle layer visibility with web SDK? Where is layer visibility command?
We've setup a workflow to toggle layer visibility. It is possible to create a custom command for a similar action? Most of the SDK examples are creating commands for a custom component instead of components that are already in place. We do have some custom service based command but those only work if there is context. Is there a way to access the esri map in the SDK?
-
There's a layers.set-visibility command, but no layers.get-visibility. https://developers.vertigisstudio.com/docs/web/api-commands-operations-events/#command-layers.set-visibility
The Esri Layer type does have a visible property (see https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#properties-summary), so you might be able to directly access that somehow.
0 -
Version 5.22.1
If I setup a button to use a custom command in web viewer designer I get the following error:
- Property layers is not allowed.
I've tried a few argument structure as well as converting some other commands to a custom command to check on their argument structures.
Example command
[
{
"name": "layers.set-visibility",
"arguments": {
"layers":["Flood Hazards"],
"visible":true
}
}
]0 -
Ah, I see the command was added with 5.23.
0
Comments
3 comments