Map Spinner never stops for continues updates

500
2
08-04-2017 07:15 AM
YamunadeviRathinasamy
New Contributor II

All,

I have spinner for map using "update-start" and "update-end".

I have dropdown to select the map service to add on map. The spinner works fine if do not switch the dropdown till the spinner stops on map.

If I add/remove layer when map spinner visible then the spinner never stops. because the last event fired was "update-start" and there is no update-end gets fired.

This app is developed using arcgis js api 3.20 and angular2.

Thanks,

yamuna.

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Yamuna,

  So on your dropdown change event handler make sure you fire the same code/function that gets fired when update-end get fired.

0 Kudos
DavidWilton
Occasional Contributor

I had this issue, I think there is actually a bug in the JSAPI. If you remove a layer whilst it is updating then it actually breaks the "update-start" and "update-end" events, they stop firing completely. I will try and put a test case together at some point but I found with a slow drawing layer, like an image service, the issue was very prevalent.

Anyway, I had to think of a way around it and this is what I came up with: 

this.layer.setVisibility(false); // set invisible first to ensure spinner stop
this.map.removeLayer(this.layer);