Feature layer query occuring on server, not client

1945
1
Jump to solution
09-10-2015 01:44 PM
BillDaigle
Occasional Contributor III

I have a an application with a feature that I'm running a selectFeatures command on.  When I created the feature layer, I put it in MODE_SNAPSHOT which should make everything available via the client.

According to the documentation, https://developers.arcgis.com/javascript/jsapi/featurelayer-amd.html#selectfeatures​, the query should run on the client, but when I look as the NET tab in the browser I can clearly see the features getting fetched from the server. 

Here is jsFiddle that should illustrate the problem: http://jsfiddle.net/nawm78kp/1/

Am I missing something?

0 Kudos
1 Solution

Accepted Solutions
BillDaigle
Occasional Contributor III

Figured it out by digging into the "_canDoClientSideQuery" function associated with the feature layer.  It appears as though the Query has to be of a very specific type for it to work. 

The Query spatialRelationship must be set to "SPATIAL_REL_INTERSECTS" and the geometry type must be an extent.  This seems overly restrictive and does not appear to be documented anywhere.

Here is a working fiddle: http://jsfiddle.net/nawm78kp/2/

View solution in original post

1 Reply
BillDaigle
Occasional Contributor III

Figured it out by digging into the "_canDoClientSideQuery" function associated with the feature layer.  It appears as though the Query has to be of a very specific type for it to work. 

The Query spatialRelationship must be set to "SPATIAL_REL_INTERSECTS" and the geometry type must be an extent.  This seems overly restrictive and does not appear to be documented anywhere.

Here is a working fiddle: http://jsfiddle.net/nawm78kp/2/