Hey guys, I am trying to filter out the geometries in a feature layer using a select box.
In c# you could just do a query on a layer then use the function featureLayerName.Update(); to refresh.
In javascript, I have something like this
query.where = "argument"
featureLayerName.selectFeatures(query, FeatureLayer.MODE_SNAPSHOT, function(results){
featureLayerName.refresh();
});
I did a queryCount and it returned the correct count, which tells me the query is working just fine. so I must be doing something wrong after I get the results.
heres a fiddle
the code in question is in the councilFilter() function.
Thanks.
Solved! Go to Solution.
Ibrahim,
If you only want to show the selected district then do not do a selection at all and just set the layers definition query
Here is a updated JSFiddle
Ibrahim,
You need to set a selection symbol for the councilDistrictLayer.
var selectionSymbol = new SimpleFillSymbol().setColor(new Color([255,255,0,0.5])); councilDistrictLayer.setSelectionSymbol(selectionSymbol);
Thanks for the reply, I did do that earlier but that what I'm trying to do is only show the selected geometry.
Ok, what I did was
Like Robert suggested, but in the query I did a <> (not equal) that way it selects all others and turns the alpha to 0.
Im sure there is a better way to do it, but in case anyone comes across the same issue, that's how I did it.
Ibrahim,
If you only want to show the selected district then do not do a selection at all and just set the layers definition query
Here is a updated JSFiddle
I knew there was some function I missed, thanks for all the help robert.