Layer List - Last Layer Dynamically Added is "Untitled layer"

2096
14
08-30-2018 05:44 PM
RyanCoodey
Occasional Contributor III

Running on the WAB built into Portal 10.6 (think that is WAB 2.6) and have a Local Scene added to an app. Used the GUI to create the app and add the widgets. Built out most the custom widget but have a few issues, one of which is with the Layer List not updating properly.

So the custom widget is just adding in some new FeatureLayers and setting their definitionExpressions (example below). The Layer List seems to refresh fine for all the layers except for the last. I have tried a variable number of layers added and it is always only the last one. The last layer shows as "Untitled layer" in the list and the visibility toggle doesn't even work. The data from the layer shows up though. Any ideas?

Example of adding a layer:

     layer = new FeatureLayer({
      title: configLayer.title,
      url: configLayer.url,
      returnZ: true, //Need to manually set as it is not pulled in from the service
      definitionExpression: "ID = 66544" //This is actually set in code just below
     });
     this.sceneView.map.add(layer);

Things I have tried:

  • making sure the layers were loaded: layer.load();
  • making sure the layers were refreshed: layer.refresh();
  • get an instance of the WidgetManager, find the LayerList and refresh()
  • this.sceneView.extent = this.sceneView.extent; (saw this potential trick in another post)
  • Add a dummy layer at the end and then remove after "layerview-create"

FYI, the Ledged widget updates just fine with the layers title.

Thanks a lot for any ideas!

0 Kudos
14 Replies
RobertScheitlin__GISP
MVP Emeritus

Yep. this.sceneView.map.add and .remove

0 Kudos
RyanCoodey
Occasional Contributor III

I removed all the code and left just two "add" layers both with hardcoded values (pasted below). Still having the problem. Tried the same code in the startup function too. Also created a new local scene in the Portal with no initial layers and set the web app to use that. I am using Portal 10.6, assuming you are using the stand alone WAB?

applyButtonClicked: function () {
   layerOne = new FeatureLayer({
    title: "one",
    url: "https://gisservices.domain.com/arcgis/rest/services/Global/Service1/FeatureServer", //Fudged the URL to hide
    id: "one",
    name: "one",
    _titleForLegend: "one"
   });
   this.sceneView.map.add(layerOne);
 
   layerTwo = new FeatureLayer({
    title: "two",
    url: "https://gisservices.domain.com/arcgis/rest/services/Global/Service2/FeatureServer"//Fudged the URL to hide
    id: "two",
    name: "two",
    _titleForLegend: "two"
   
   });
   this.sceneView.map.add(layerTwo);
},
Thanks for working through this one with me!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ryan,

  Correct I am testing use WAB Developer 2.9.

0 Kudos
RyanCoodey
Occasional Contributor III

So the good news is this is likely fixed in a later WAB, the bad is Portal will always be behind in releases to WAB. I believe Portal 10.6 is currently deployed with 2.6. Not sure how tightly coupled WAB is with Portal and the options to upgrade it on the side. I'll reach out to ESRI support and see what they say. Thanks for everything Robert! 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ryan,

  10.6.1 is already out so that would move you to 2.7 at least, worth a try.

0 Kudos