Is there an event when applyEdits - add / update features - Are ready, and visible on the map?

504
2
Jump to solution
12-01-2021 10:11 AM
AndrewMurdoch1
Occasional Contributor II

Good Day

Is there an event that will trigger once my updated / added features are visible on the map and ready for interaction?

Once the promise resolves ex:

layer.applyEdits({
    updateFeatures: data
}).then(() => {
    this.layerLoadedEvent.emit(true);
    r(null);
})

I'm still waiting for the features to be visible on the map, is there any event to let me know when everything is ready?

Thanks

0 Kudos
1 Solution

Accepted Solutions
BlakeTerhune
MVP Regular Contributor

If you're looking for an event, try the edits event, which fires after applyEdits() is completed successfully. If you need to know when the layers are done drawing in the map, try watchUtils(). Here's some more info.

If you want to do something when the applyEdits() promise resolves, you should be able to do it in the .then like you have it there. Here's a sample.

View solution in original post

2 Replies
BlakeTerhune
MVP Regular Contributor

If you're looking for an event, try the edits event, which fires after applyEdits() is completed successfully. If you need to know when the layers are done drawing in the map, try watchUtils(). Here's some more info.

If you want to do something when the applyEdits() promise resolves, you should be able to do it in the .then like you have it there. Here's a sample.

AndrewMurdoch1
Occasional Contributor II

That accomplished exactly what I'm looking for 🙂 - Thanks!

0 Kudos