I also got a filter function that works on feature layers but I just got the graphics in the map to be filtered. If I could grab the item attributes of the table I could filter it also. Here is the function and the class created for it
import com.esri.ags.Graphic;
import com.esri.ags.events.GraphicEvent;
import com.esri.ags.events.LayerEvent;
import mx.collections.ArrayCollection;
[Bindable]
private var totalGraphicsShown:String = "";
private var filterParam:String;
protected function onFilterClick(event:MouseEvent):void
{
var bt:Button = Button(event.target);
switch (bt.id)
{
case bt100.id:
filterParam = "AL";
break;
case bt300.id:
filterParam = "AU";
break;
case bt500.id:
filterParam = "BE";
break;
case bt700.id:
filterParam = "CY";
break;
case bt900.id:
filterParam = "CA";
break;
}
myFeatureLayer.setFilterFunction(providerFilterFunction);
}
protected function onClearFilters(event:MouseEvent):void
{
myFeatureLayer.setFilterFunction(null);
}
protected function providerFilterFunction(item:Object):Boolean
{
var isFiltered:Boolean = false;
var gr:Graphic = Graphic(item);
if (gr.attributes.NAME_SH == filterParam)
{
isFiltered = true;
}
return isFiltered;
}
package MyFeatureLayer
{
import com.esri.ags.layers.FeatureLayer;
import com.esri.ags.events.LayerEvent;
import com.esri.ags.layers.FeatureLayer;
public class MyFeatureLayer extends FeatureLayer
{
public function MyFeatureLayer(url:String=null, proxyURL:String=null, token:String=null)
{
super(url, proxyURL, token);
}
public function setFilterFunction(func:Function):void
{
$graphicProvider.filterFunction = func;
$graphicProvider.refresh();
dispatchEvent(new LayerEvent(LayerEvent.UPDATE_END, this, null, true));
}
}
}