i know that the filter function will work the same way. but i have a problem
with integrating a checkbox filter into a large multi filter function. let me
explain... i have a number of controls that am currently using to filter data
from a database. so i developed a multi filter function to handle the filtering
depending on what control is picked by the user. it works well but one problem
i have is that i have failed to find a way to include a checkbox control into
the multi filter function. below is the multi filter function am using and
would like to include a checkbox filter to it.
private var sliderFromValue : Number = 0;
private var sliderToValue : Number = 3000000;
private var selectedCity : String = "All";
private var selectedLocation : String = "All";
private var selectedValue: Boolean;
private var poolSelected: Boolean = false;
private function onSliderChange(event:SliderEvent):void
{
var slider:Slider = Slider(event.currentTarget) ;
sliderFromValue = priceSlider.values[0];
sliderToValue = priceSlider.values[1];
filterGrid() ;
currentState = '';
}
private function cityChangeHandler(event:Event):void
{
if( city_cb.selectedItem != null )
selectedCity = city_cb.selectedLabel;
filterGrid();
currentState = '';
}
private function locationChangeHandler(event:Event):void
{
if( lct_cb.selectedItem != null )
selectedLocation = lct_cb.selectedLabel;
filterGrid();
currentState = '';
}
private function categoryChangeHandler(event:Event):void
{
if(category.selectedValue != null)
selectedValue = category.selectedValue;
filterGrid();
currentState = '';
}
private function poolFilter():void
{
poolSelected = pool_ckb.selected;
filterGrid();
currentState = '';
}
private function filterGrid() :void
{
dataAr.filterFunction=myFilterFunction;
dataAr.refresh();
}
private function myFilterFunction(item:Object): Boolean
{
return(item.price >= sliderFromValue && item.price <=
sliderToValue)&&
(item.city == selectedCity || selectedCity == "All") &&
(item.location == selectedLocation || selectedLocation
== "All") &&
(item.category == category.selectedValue)&&
(item.pool == poolSelected);
}
the individual filter functions are attached to individual controls but the
poolfilter is the one that is troubling me.