FeatureLayer.selectFeatures does not work when using a where clause

Discussion created by rmetzger86 on Jul 25, 2013
Latest reply on Jul 26, 2013 by rmetzger86

I am trying to select features from a feature layer using a query with a where clause. It returns the correct features, but does not draw them. When I do the same thing but use a query with the geometry property set to a polygon, the correct features are returned AND drawn on the map. How do I get this to draw the feature layer when using a where clause with the query?

Here is my code:

    var featureLayer = new esri.layers.FeatureLayer(arcGisServerUrl + "/" + serviceLayerId, {
        mode: esri.layers.FeatureLayer.MODE_SELECTION,
        outFields: ["*"],
        id: featureLayerName

    var query = new esri.tasks.Query();
    query.outFields = ["*"];
    query.returnGeometry = true;
    query.where = "1=1";

    featureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, HandleRouteSelectFeaturesResults);