well, am trying to integrate some checkbox filter into a multiple filter
function and its giving me hell. basically am trying to filter an
arraycollection based on multiple criteria using different components like
slider, combo box, radio buttons and check boxes. while i have the rest of the
component filters working, i cant figure out a way to include the checkbox
filter into the filter function. here is my code so far.
////////////////////////filters//////////////////////////////////////////////////////////////////////////
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);
}
there is something wrong with the poolfilter function which affects the general
filter function. i would like that if someone clicked the pool checkbox, only
property with pools show and if they uncheck it, then all property shows up.