I have had to replicate, duplicate, and masticate (it means chew, people) several layers on a web map in order to get them to show up like the clients want them to be shown.
However, now I have a LayerList that is obnoxious with repetitive layers.
Can I remove layers from the LayerList?
And how?
Solved! Go to Solution.
I agree with you Robert Scheitlin, GISP . I only would like to know where is it possible to reload the layers on LayerListWidget (because it loads only one time). Best regards.
Ezequias,
The onOpen method gets called each time the widget is made visible.
Thanks a lot. That's what I really need. Everyone can find it at BaseWidgetPanel.js.
My best regards.
Ezequias
Thank you Robert Scheitlin, GISP
I am focused on removing layers and adding it again (like a filter). I am using the layerlistView.destroy() method but even the layers were hidden on LayerListWidget this action doesn't reflect on the map.
I also tried to run window.layerlistView.postCreate() but without any success.
Another question I would like to know if there is some method that is executed right in the loading of the map (importing the application map set) because I couldn't find it out.
I also noted that some methods like refresh and load are not public on the dijit api.
Could you give me some directions so i can find out a plausible solution to this case.
My best regards
Ezequias Rocha
Ezequias,
Are you saying that if you use map.removeLayer(x); that the layer list widget does not update automatically?
I am trying to execute this method this way window.layerInfo.map.removeLayer(window.layerInfo.map.getLayer("The layer name")) but it does not work.
Ezequias,
If you are using that code in a widget then you should just use
this.map.removeLayer(this.map.getLayer("the layer name"));
Sorry but I am getting this error:
Uncaught TypeError: this.map.getLayer is not a function(…)(anonymous function)
If you are in a widget then you will have access to this.map unless you are in a call back function that is out of scope and you did not use lag.hitch.
I am calling the method from web browser console.