Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support to add & remove layer(s) from the Layer Control
//add new layer function _setupSampleLayer(args) { var layer = args.layer; var target = args.target; layer.setVisibility(true); layer.opacity = 1; for (var i = 0; i < 8; i++) { var eLayerInfo = layer.layerInfos[i]; eLayerInfo.defaultVisibility = true } }; function _loadSampleLayer() { var imageParameters = new esri.layers.ImageParameters(); imageParameters.layerIds = [0,1,2,3,4,5,6,7]; imageParameters.layerOption = esri.layers.ImageParameters.LAYER_OPTION_SHOW; var layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://<server>/arcgis/rest/services/<service>/MapServer", {id: "MyMapService", visible : true, imageParameters : imageParameters } ); layer.on("load", function(args) { _setupSampleLayer(args); }); layer.on("error", function(args) { debugger; }); this.app.map.addLayer(layer); this.app.map.on("layer-add-result", function(args) { var layer = args.layer; var error = args.error; var layerInfo = { title : "My Sample Title", type : "dynamic", layer : layer } dojo.publish('layerControl/addLayerControls', [[layerInfo]]); }); } //remove layer dojo.publish("layerControl/removeLayerControls", [["My Sample Title"]])
- Loading branch information