-
-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setVisibleLayers makes all sublayersvisible if group layer id is a part of array #633
Comments
This issue has come up a few times. I've run into it before as well. But first, just to clarify a few things...
How are you setting the visible layers? If you could share the relevent code in a gist, it would be much easier to offer advice. Also, when are you setting the visible layers? Is it before or after the LayerControl (and other widgets) load? |
I am using local storage to get the layers as JSON array and one of the parameter is visibleLayers which is an array of visible layer IDs. I am calling this function in LayerControl.js after everything loads. |
@roemhildtg Can you please help me with this? |
@deepal13 can you provide a repository with code demonstrating this issue? Probably most helpful to create a stand-alone widget and not modify the core CMV layerControl widget. |
@deepal13 I agree with @tmcgee, I wouldn't modify the core CMV widget since it'll be harder for you to update in the future. If you write a widget that does this for you, you can use |
@deepal13 I think the solution here is to exclude group layers from your |
Hello,
I am trying to set visibility of sublayers using setVisibleLayers(). If I pass the group layer id of a sublayer in the array then the TOC works fine(checks group layer and specific sublayer), but the map shows all the sublayers. If I don't pass the group layer,then the group layer is unchecked in TOC and so even if the map looks right (shows only specific sublayer) at first, as soon as I click on any other sublayer, all the sublayers disappear.
Can anyone please help me?
Thanks
The text was updated successfully, but these errors were encountered: