Select to view content in your preferred language

4.7 - Untitled Layer is being visible in layerList Widget when i define new SketchViewModel

2052
4
05-16-2018 12:55 AM
TubaKumbara
Regular Contributor

hello. 

I defining a new graphicslayer which has listmode property value as "hide". And this graphicslayer doesn't show in layerlistwidget (this is what i want)

var myg = new graphicsLayer({

    listMode: "hide";

})

mymap.add(myg);

new sketchView 

var s = new SketchViewModel({

   view: mySceneView,

   layer: myg,

});

when i run this code an Untitled Layer is being visible on layerlist.

This layer is not myg. Another new layer.

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Tuba,

   I see what you are talking about and the only way to fix this I have found is with this work around (lines 18 - 24):

      view.when(function() {
        var layerList = new LayerList({
          view: view
        });

        // Add widget to the top right corner of the view
        view.ui.add(layerList, "bottom-right");

        // create a new sketch view model
        var sketchViewModel = new SketchViewModel({
          view: view,
          layer: tempGraphicsLayer,
          pointSymbol: pointSymbol,
          polylineSymbol: polylineSymbol,
          polygonSymbol: polygonSymbol
        });

        setTimeout(function(){
          layerList.operationalItems.items.map(function(item){
            if(!item.layer.title && item.layer.type === "graphics"){
              item.layer.listMode = "hide";
            }
          });
        }, 200);

You really need to log a bug with esri tech support on this.

UndralBatsukh
Esri Regular Contributor

Hi there, 

We will address this issue in our future release. Thank you pointing it out. 

ChesouyeCoye
Emerging Contributor

I am having the same issue. I have attached a snippet. I do not know why there is a untitled layer as I have done weeks of debugging and it doesnt work. untitled layer.PNG

0 Kudos
JustinCarasick
Emerging Contributor

I figured a workaround with this. I had to hit a private member and use it's hide setting.

this.sketchViewModel._defaultGraphicsLayer.listMode = "hide";