MapImageLayer sublayers not showing in LayerList?

732
0
05-11-2017 10:41 AM
CharlieElverson
New Contributor II

I'm using a LayerList to manage layers in the associated map, but none of the sublayers show up in the LayerList widget. The LayerList does not have it's view property set, as I found this allowed me to manually manage the operationalItems.

My intention is to maintain a list of the available layers but only create and add the layers to the map when they're needed. So, the layers are created as follows (typescript): 

            let newItem = new ListItem();
            newItem.layer = new MapImageLayer({
                url: item.url,
                id: item.id,
                title: item.title,
                listMode: 'show',
                visible: false
            })
            newItem.title = item.title;
            newItem.layer.watch("visible", this.toggleLayer);
            itemArray.push(newItem);‍‍‍‍‍‍‍‍‍‍‍

itemArray is then used to create the LayerList operationalItems, and the toggleLayer method essentially adds the layer to the map, if it wasn't already.

Thanks.

Tags (2)
0 Kudos
0 Replies