Add feature layer back to map after removing it

101
1
05-07-2020 12:13 AM
ZianChoy
Occasional Contributor

When I removed a feature layer with a heatmap renderer in the latest version of the 3.x JS API, nothing appeared in the map after adding it back.


You can reproduce the problem by going to https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=renderer_heatmap_weighted  and making a tweak to the valCtrl.addEventListener function.

Insert the following as the first line in the function:

          map.removeLayer(heatmapFeatureLayer);

And put this line right above the call to redraw():

          map.addLayer(heatmapFeatureLayer);

Then, click the refresh button and try moving a slider or unchecking a checkbox in the map. Nothing will appear in the map.

In my real application, I have ~6 different groups of layers that get swapped in and out of the map depending on the displayed attribute. For instance, 1 group might show the "Geocoder" string attribute with only 1 layer and another group might show a "Derived Number" attribute with 3 layers.

What would be the best way to overcome this bug in the JS API?

0 Kudos
1 Reply
ZianChoy
Occasional Contributor

ESRI support confirmed that this is a bug in the JavaScript API.

0 Kudos