Programatically filter LayerList widgets in JS API 4.9

381
0
02-25-2019 09:16 AM
Jay_Gregory
Occasional Contributor III

I have an app with two LayerList widgets in different sections of the app.  One layer list widget is displaying all layers added to the map.  I want to make it so the second layer list widget only displays a subset of the layers added to the map - ie, layers a user uploads from their computer locally (geojson, csv, kml, etc.).  

Is there any way in the listItemCreatedFunction to just remove layers that don't meet this criteria?  Unclear how to achieve this.  With only one layerlist widget I could set listMode on the layer to 'hide,' but this won't work for my purposes, since my first layer list needs to display all layers.  I haven't figured out how to intercept this function and just not add the item to the widget in the first place....

Thanks! 

0 Kudos
0 Replies