GraphicsLayer addMany finish rendering

562
3
09-14-2017 11:06 AM
RodrigoFelga
New Contributor III

I have a array of graphics that I'm adding to a GraphicsLayer with the following code:

gLayer.addMany(features); 

This works correctly but I need to catch when then graphics finished rendering on the map because many times the array has many graphics and I need to show a loading to the user.

Thanks

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Rodrigo,

   You just need to watch the layer view updating property for false.

view.whenLayerView(gLayer).then(layerView => {
    watchUtils.whenFalse(layerView, 'updating', () => {
        console.log('The layer is now rendered');
    });
});
RodrigoFelga
New Contributor III

Thanks for your reply. I did that but it triggers before the graphics appears on the screen.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Rodrigo,

   That is strange the updating property is suppose to be the property to watch. I have used it and it worked fine on my end. Maybe you can just add a settimeout inside the result function for a couple hundred milliseconds.

0 Kudos