AnsweredAssumed Answered

queryFeatures does not return if query has no results

Question asked by Mapjection on Jan 3, 2014
Latest reply on Jan 6, 2014 by Mapjection
featureLayer.queryFeatures appears to not execute the callback if there are no features that match the query.

I have modified the following sample to illustrate (JS API 3.8):

If one replaces the contents of function queryRecordsByPage with the following (obviously without the line numbers):

    1.  var query = new Query();     2.  //query.objectIds = pageInfo.objectIds.slice(begin, end);     3.  query.outFields = ["*"];     4.  query.geometry = featureLayer.fullExtent;     5.  //query.geometry = new esri.geometry.Extent(-1, -1, 1, 1, 4326);      6.  // Query for the records with the given object IDs and populate the grid     7.  featureLayer.queryFeatures(query, function (featureSet) {     8.    updateGrid(featureSet, pageNumber);     9.  });

- updateGrid (line 8) gets called with the code as it is shown above. This is expected, as our query geometry has points within it.
- when I comment out line 4 and uncomment line 5, updateGrid (line 8) doesn't get called at all (in this case, no points are within the custom extent).

Is this normal behaviour for featureLayer.queryFeatures?  I was hoping the callback would trigger, returning an empty feature set (so my code can react to the "nothing within this extent" case).
Any feedback is appreciated.  Thanks.