From e7fe3d12b858184332898846bd8e1af3915e2a76 Mon Sep 17 00:00:00 2001 From: cmndrbensisko Date: Tue, 17 Nov 2015 08:07:50 -0500 Subject: [PATCH] Bug fix for Dynamic services containing a single layer, updated manifest --- README.md | 2 +- Widget.js | 6 ++++-- manifest.json | 5 ++--- setting/DynamicLayerEdit.js | 12 +++++++++--- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ded49f5..f6b5c4e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -LocalLayerWidget 1.2.1 +LocalLayerWidget 1.2.2 == The LocalLayer Widget for ArcGIS Web AppBuilder is intended to allow the direct addition of ArcGIS for Server MapServices to an ArcGIS Web AppBuilder application, without needing to wrap the desired services in an ArcGIS Online/Portal Web Map. The Legend, LayerList, and AttributeTable widgets should continue to work with your Local Layers. diff --git a/Widget.js b/Widget.js index bc2a3a3..e8b4560 100644 --- a/Widget.js +++ b/Widget.js @@ -104,8 +104,10 @@ define([ lOptions.id = layer.name; } if(layer.hasOwnProperty('hidelayers')){ - lOptions.hidelayers = [] - lOptions.hidelayers = layer.hidelayers.split(','); + if (layer.hidelayers){ + lOptions.hidelayers = [] + lOptions.hidelayers = layer.hidelayers.split(','); + } } if(layer.hasOwnProperty('minScale')){ lOptions.minScale = layer.minScale diff --git a/manifest.json b/manifest.json index 84c917c..f083c38 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "LocalLayer", "label": "Local Layer Widget", "platform": "HTML", - "version": "1.2", + "version": "1.2.2", "wabVersion": "1.3", "author": "Adam Drackley (adam.drackley@gmail.com) & Robert Scheitlin", "description": "This widget is for adding local layers to Web AppBuilder", @@ -12,7 +12,6 @@ "inPanel": false, "hasConfig": true, "hasStyle": false, - "hasUIFile": false, - "supportMultiInstance": false + "hasUIFile": false } } diff --git a/setting/DynamicLayerEdit.js b/setting/DynamicLayerEdit.js index 7a678ec..4069252 100644 --- a/setting/DynamicLayerEdit.js +++ b/setting/DynamicLayerEdit.js @@ -186,7 +186,11 @@ define( var hiddenLayer; var isVisible = args.config.defaultVisibility; if(this.config.hasOwnProperty('hidelayers')){ - hiddenLayer = this.config.hidelayers.split(','); + if (this.config.hidelayers){ + hiddenLayer = this.config.hidelayers.split(','); + }else{ + hiddenLayer = []; + } if(array.indexOf(hiddenLayer, args.config.id) >= 0){ isVisible = false; //isVisible = true; @@ -230,11 +234,13 @@ define( var visibleLayers = []; array.map(rowsData, lang.hitch(this, function (item) { + if (item.layerindex == ""){item.layerindex = "0"} if(!item.visible){ - if (item.layerindex == ""){item.layerindex = "0"} visibleLayers.push(parseInt(item.layerindex)) } })); +var _hideLayers = visibleLayers.join(); +if (_hideLayers == ""){_hideLayers = null}; var dynamiclayer = { type: 'Dynamic', name: this.layerTitle.get('value'), @@ -248,7 +254,7 @@ define( minScale: this.minScale.get('value'), maxScale: this.maxScale.get('value'), //hidelayers: allHiddenLayers.join() - hidelayers: visibleLayers.join() + hidelayers: _hideLayers }; return [dynamiclayer, this.tr]; },