Select to view content in your preferred language

FeatureLayer with ServiceFeatureTable notification when finish to load

618
2
09-13-2022 03:02 PM
Labels (2)
HomeroOriaAguilera
Emerging Contributor

Hi, How can I have a notification or signal when a service feature table loads finish?

 I test with signals

loadStatusChanged

and

LoadOrRefreshFeaturesStatusChanged

 but with the first, returns Ok immediately, and with the second one I haven't answer.

The service feature table delays about 15-30 secs to gather all the data.

Maybe I missed something...

0 Kudos
2 Replies
Gela
by Esri Alum
Esri Alum

Are there any particular reasons you are using LoadOrRefreshFeaturesStatusChanged? 

You should be able to listen to the load status of the service feature table using the following:

serviceFeatureTable.loadStatusChanged.connect(()=> {
if (serviceFeatureTable.loadStatus !== Enums.LoadStatusLoaded)
return;

//Perform other operations if the service feature table is loaded...
});

 

If you are set on using the second signal, you can see why it is erroring out by connecting an error changed listener and getting the exact error:

serviceFeatureTable.errorChanged.connect(()=>{
console.log(serviceFeatureTable.error.message + serviceFeatureTable.error.additionalMessage);
}); 

 

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

The LoadStatusChanged event tells you when the object has fetched it's metadata, e.g. in the case of a ServiceFeatureTable that means it's made the initial request to the service to get the JSON definition of the table/layer. After than, once the ServiceFeatureTable is the source for a FeatureLayer in a MapView, then it starts requesting features based on the visible extent and/or queries (depending on what functionality you write in your app).

There are additional events on the GeoView (MapView/SceneView) that you can listen to if you'd like to know:

0 Kudos