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):
<SPAN class="keyword token">let</SPAN> newItem <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ListItem</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
newItem<SPAN class="punctuation token">.</SPAN>layer <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">MapImageLayer</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
url<SPAN class="punctuation token">:</SPAN> item<SPAN class="punctuation token">.</SPAN>url<SPAN class="punctuation token">,</SPAN>
id<SPAN class="punctuation token">:</SPAN> item<SPAN class="punctuation token">.</SPAN>id<SPAN class="punctuation token">,</SPAN>
title<SPAN class="punctuation token">:</SPAN> item<SPAN class="punctuation token">.</SPAN>title<SPAN class="punctuation token">,</SPAN>
listMode<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'show'</SPAN><SPAN class="punctuation token">,</SPAN>
visible<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">false</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN>
newItem<SPAN class="punctuation token">.</SPAN>title <SPAN class="operator token">=</SPAN> item<SPAN class="punctuation token">.</SPAN>title<SPAN class="punctuation token">;</SPAN>
newItem<SPAN class="punctuation token">.</SPAN>layer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">watch</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"visible"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>toggleLayer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
itemArray<SPAN class="punctuation token">.</SPAN><SPAN class="token function">push</SPAN><SPAN class="punctuation token">(</SPAN>newItem<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>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.