My problem is that my map created using esri.arcgis.utils.createMap(webmapItem), only queries layers initially turned on in ArcGIS Online Web Map. I hope someone here can help me. In my web map application I want to toggle layers in a web map layer on/off using setVisibleLayers(). When updating the visibleLayers, the layers are correctly toggled on/off, but if I click my map, the map only queries the layers that are turned on in web map saved on ArcGIS Online, regardless of the updated visibleLayers property on my map layer in the application.The clickHandler is returned initially in the response object returned by createMap(). Is there a way to update this with the current visible layers?map = esri.arcgis.utils.createMap(webmapid, mapDiv);
...
var layer = map.getLayer(map.layerIds[1])
layer.setVisibleLayers([1,2]);
//layer visibilities are updated correctly in map - but the change is not reflected in clickHandle
Usage: I want to toggle layer visibility in a TOC and have the queries working on the visible layers.