Select to view content in your preferred language

Multiple copies of widget in builder

3267
15
Jump to solution
01-13-2016 01:35 PM
RichardMacNeill1
New Contributor II


I am making a start on widget development, and have developed and deployed a widget after several false starts. After a false start attempting to deploy a faulty widget, I removed the widget folder from the widgets parent folder, corrected the problem, and then replaced it. I now have four copies of this widget in the builder. Two have an icon (one is a copy) and the other two do not respond and have no icon.

How do I clean this up by removing unnecessary or duplicate widgets?

Tags (1)
0 Kudos
15 Replies
RobertScheitlin__GISP
MVP Emeritus

Richard,


  Glad it worked. Don't forget to mark the thread as answered.

0 Kudos
RichardMacNeill1
New Contributor II

UNCLASSIFIED

Many thanks for your previous assistance.

Can you help me here? I'm a new user attempting to get my head around Widgets and Javascript. I'm trying to add a layer to test further script, and am encountering a problem (see code below).

The function below is accessed, so that my first two alerts respond. However, the "map.addLayer( ) command does respond and I receive no final alert. Is there something straightforward that I'm not getting? Commenting out the mode: and outfields: makes no difference.

alert("Adding Layer");

require(["esri/map","esri/layers/FeatureLayer","dojo/domReady!"],

function(map,FeatureLayer) {

var map = this.map;

var extent = map.extent;

var mapSpatRef = map.spatialReference;

var featureLayer = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/3",{

mode: FeatureLayer.MODE_ONDEMAND,

outFields: ["*"]

});

map.addLayer(featureLayer);

alert("Layer added");

});

...

Thanks

Richard MacNeill

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Richard,

   Every widget has access to the WAB map using the built in var this.map. there is no need to require map or set a local var to the map only use this.map.addLayer(featureLayer);

0 Kudos
RichardMacNeill1
New Contributor II

UNCLASSIFIED

Thanks Robert

I've removed the var map = this.map and the two succeeding var statements.

I'm still not getting any response from the map.addLayer(featureLayer) and am beginning to think the problem lies in the layer requested. Any thoughts.

Thanks

Richard

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Richard,

   Can you use a console.info(this.map); to check if you are in the proper scope to get access to the map?

0 Kudos
RichardMacNeill1
New Contributor II

UNCLASSIFIED

Bad news I'm afraid.

I replaced the copy of the repoitems file that I had removed and redeployed my widget. Then restarted the WebApp builder.

Now when I edit an app, my Theme tab is empty and there are no available widgets at all.

This is clearly a more serious problem but may involve a simple link. Do you have any suggestions?

Richard

0 Kudos