How to detect if a layer was draw completely?

2463
1
Jump to solution
04-13-2016 12:34 PM
RobertoOliveira
New Contributor III


I have a feature layer with many features, and when I load on map viewer (Portal for Arcgis), I receive a message that 'Layer did not draw completely'. This is ok, because this layer don't have any visible range configured and have many features.

But, when I try to use this feature layer on ArcGIS API for Javascript, the layer don't draw completely too, but I don't know how detect if this layer was draw completely or not (to show a message for the user).

I already tried the 'update-end' event of feature layer, but this event don't show any error, even when the layer was not draw completely.

Code:

var featureLayer = new FeatureLayer("http://server/acgis/rest/services/ServiceTest/FeatureServer/0", {
  mode: FeatureLayer.MODE_ONDEMAND,
  outFields: ["*"]
});


featureLayer.on("update-end", function(e) {
  console.log(e);
});


map.addLayer(featureLayer);
0 Kudos
1 Solution

Accepted Solutions
RobertoOliveira
New Contributor III

I founded (I think):

This information was not on 'error' property, but in 'info' property!

featureLayer.on("update-end", function(e) {
  if (e != undefined && e.info != undefined && e.info.queryLimitExceeded) {
    console.log("Layer did not draw completely");
  }
});

In FeatureLayer | API Reference | ArcGIS API for JavaScript, on update-end event, the Event Object has a 'error' property and a 'info' property, and looking at documentation, the info property has the following information:

Optional object that may have a boolean queryLimitExceeded property. queryLimitExceeded will be true if the feature layer could not draw all features due to a maxRecordCount limitation on the query operation. As of v2.8

View solution in original post

1 Reply
RobertoOliveira
New Contributor III

I founded (I think):

This information was not on 'error' property, but in 'info' property!

featureLayer.on("update-end", function(e) {
  if (e != undefined && e.info != undefined && e.info.queryLimitExceeded) {
    console.log("Layer did not draw completely");
  }
});

In FeatureLayer | API Reference | ArcGIS API for JavaScript, on update-end event, the Event Object has a 'error' property and a 'info' property, and looking at documentation, the info property has the following information:

Optional object that may have a boolean queryLimitExceeded property. queryLimitExceeded will be true if the feature layer could not draw all features due to a maxRecordCount limitation on the query operation. As of v2.8