ESRI JavaScript API 4x - Layer List and Legend Working Together Bug/Issues

661
0
12-08-2020 05:35 AM
IanPeebles
Occasional Contributor III

Good morning.  Has anyone else noticed the buggy nature of the layer list widget and the legend when working with JavaScript API version 4x?  The issue has to do with the symbology changing in the legend when checking on the web service layer in the layer list.  When the map loads, the layer list looks good and the legend looks good.  If you click on any layers within the layer list, the symbology changes to the incorrect symbology in other map services.  I am using the basic out-of-the box JS API settings.  My base map layer does have a group layer.

I have logged in a bug with ESRI.

Here are some screenshot examples:

01. Layer List on Application Load

LayerListOnLoad01.jpg

Legend Onload:

GPSLayersOnLoad.jpg

LegendOnLoad01.jpg

 

Now if I toggle back to the layer list, then turn off  both web services in the layer list, the symbology will change for the base map service when I toggle back to the legend.  ESRI has duplicated this behavior using their data.  The behavior is inconsistent.  Notice the incorrect symbology for the Base Map service shown below:

There are line and polygon features for the base map that show point features from the GPS layer.

LegendBug.jpg

 

The LayerList/Legend in JS API 3x has better functionality.  Hopefully, other people have encountered this issue.  This should be resolved, because having a functioning layer list with legend is crucial for our applications.  If the symbology changes, then end users will notice and the application is not functional.

Finally, here is the code I use for the layer list widget and legend in the 4x environment:

AppCodeSample.jpg

Thank you for the review.

 

0 Kudos
0 Replies