Keep loading screen until everything has finished loading

332
0
09-12-2020 04:58 PM
MarkC1
by
Occasional Contributor

I've a problem similar to the one discussed in this thread:

Keep Loading Screen Up Longer in WAB 

I am filtering the feature layer in my app based on the logged in user before loading. I'm then changing the extent of the map based on the filtered features. Both of these steps are fine.

I apply the filter in MapManager.js and then I get the extent of the filtered features using an "update-end" event like below. The event is required otherwise the graphics array will be zero presumably because the graphics layers aren't don't seem to be available yet.

this.filterManager.applyWidgetFilter("mylayer", null, "email = test@example.com");

var layer = this.map.getLayer("mylayer");

on.once(layer, 'update-end', function(){
 var myextent = graphicsUtils.graphicsExtent(layer.graphics);
 map.setExtent(myextent);
 });‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Anyway this all works fine. My map loads, gets filtered and then zooms to the extent of the filtered features.

I would really like the zoom when changing extents to be invisible to the end user however (i.e. the map has already zoomed to the extent of the filtered features by the time the loading screen is removed). The only way I can think to do this is to keep the loading screen up a little longer. I don't think it will be possible to set the initial extent any earlier due to needing to load the graphics layer in order to determine the filtered extent.

I've played around with the suggestion in the thread linked above with no success. For example, I've commented out

html.setStyle(jimuConfig.mainPageId, 'display', 'block');

 , in main.js , and then added

html.setStyle(window.jimuConfig.loadingId, 'display', 'none')
html.setStyle(window.jimuConfig.mainPageId, 'display', 'block');

, into my update-end event function but I get weird behavior and I'm not able to hide the zooming.

Maybe it's not possible to do anything about this or maybe I just need my code in a different place?

Tags (1)
0 Kudos
0 Replies