FeatureLayer not honoring definition expression

Discussion created by citizens on Jul 8, 2012
Latest reply on Jul 9, 2012 by citizens
I have a featureCollection object (not a server resource) that is being successfully added to an app as an esri.layers.FeatureLayer, displaying all features correctly.

I have tried to set the definition expression immediately after creating the FeatureLayer, after adding the FeatureLayer to the map and after an input element (checkbox) onchange event.

The dom shows that the definition expression is being set on the FeatureLayer, but the FeatureLayer will not honor the definition expression, continues to display all features.

***Are FeatureLayers created from featureCollection ( esri.layers.FeatureLayer(featureCollectionObject, options?) ) supposed to honor the definition expression or not?***

countyLayer = new esri.layers.FeatureLayer(counties.featureCollection.layers[0]);
countyLayer.setDefinitionExpression("NAME = 'VOLUSIA'");
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,255,255,1.0]), 1),new dojo.Color([125,125,125,0.35]));
countyLayer.setRenderer(new esri.renderer.SimpleRenderer(symbol));