hi Tim, thanks your solution worked well. for anyone who is interested
in filtering a datagrid with multiple criteria here is how i pieced up
mine through the enormous help from this group.
////////////////////////filters//////////////////////////////////////////////////////////////////////////
private var sliderFromValue : Number = 0;
private var sliderToValue : Number = 3000000;
private var selectedCity : String = "All";
private var selectedLocation : String = "All";
private function onSliderChange(event:SliderEvent):void
{
var slider:Slider = Slider(event.currentTarget) ;
sliderFromValue = priceSlider.values[0];
sliderToValue = priceSlider.values[1];
filterGrid() ;
dataAr.refresh();
}
private function cityChangeHandler(event:Event):void
{
if( city_cb.selectedItem != null )
selectedCity = city_cb.selectedLabel;
filterGrid();
dataAr.refresh();
}
private function locationChangeHandler(event:Event):void
{
if( lct_cb.selectedItem != null )
selectedLocation = lct_cb.selectedLabel;
filterGrid();
dataAr.refresh();
}
private function filterGrid() :void
{
dataAr.filterFunction=myFilterFunction;
dataAr.refresh();
}
private function myFilterFunction(item:Object): Boolean
{
return (item.city == selectedCity || selectedCity ==
"All") &&
(item.location == selectedLocation || selectedLocation
==
"All") &&
(item.price >= sliderFromValue && item.price <=
sliderToValue) ;
}
then on each of the controls in my case 2 combo boxes and a slider
call their individual filter functions in the change event like this
<mx:ComboBox x="0" y="108" width="182" id="lct_cb"
labelField="lct_name" change="locationChangeHandler(event)"
selectedIndex="0"/>
<mx:ComboBox x="0" y="52" width="182" id="city_cb"
labelField="city_name" change="cityChangeHandler(event)"
selectedIndex="0"/>
<mx:HSlider x="0" y="240" id="priceSlider" minimum="0"
maximum="3000000" allowThumbOverlap="false" tickInterval="100000"
snapInterval="100000" thumbCount="2" values="[0,3000000]"
tickColor="#ffffff" labels="[$0k,$3000000M]" liveDragging="true"
width="182" change="onSliderChange(event)"/>
hope someone will find this useful. thanks