AnsweredAssumed Answered

I want to change mode from MODE_SNAPSHOP to MODE_ONDEMAND at runtime

Question asked by LarsHalvor.Anundskaasgeodata-no-esridist Employee on Mar 18, 2015
Latest reply on Mar 18, 2015 by ad_giles@hotmail.com

I have a featurelayer in my map, added with MODE_SNAPSHOT, so that all features are showing.

I want the user to be able to switch to MODE_ONDEMAND, the behavior i want is that the layer will be redrawn with only the features within the screen.

 

It works as expected when i add it to the map in the first place, with either MODE_ONDEMAND or MODE_SNAPSHOT, but I havent figured out how I can change it at runtime, after it has been added to the map.

 

This does not work:

 

featureLayerInstance.mode = FeatureLayer.MODE_ONDEMAND;

featureLayerInstance.refresh();

 

Looking at the requests, geometry are not added and removed to the parameters to the request when toggling mode at runtime, like it does when i add the layer with MODE_ONDEMAND in the first place.

 

Ideally I would like it to automatically do a geometry query with MODE_ONDEMAND, and a "1=1" query with MODE_SNAPSHOT

 

Does anyone know how i can achieve this at runtime without removing and readding the layer etc.?

Outcomes