Basically I have three dynamic map services and I have added all of them onto the map. Everytime I made a selection, I want the layers in my layerlist widget to change and the options displayed will be altered based on what layers are available in each of my map service. The layer list widget I am using is this: https://developers.arcgis.com/javascript/3/jsapi/layerlist-amd.html Currently, I call the following function everytime a different map service is selected:
However, nothing has changed. Any suggestions? | |
I don't think the refresh method takes any arguments. Rather redefine the widget.layers property to your new layers array and then call the refresh method.
function refresh(curLayer){ widget.layers = [ {layer: curLayer } ]; widget.refresh(); }