Ah ok... I've got you. How about trying this for the filter function?

 

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)&&
(!poolSelected || item.pool); 
}



The (!poolSelected || item.pool) will equate to true when the checkbox
isn't selected (!poolSelected ) or when the item has a pool when the
checkbox is selected (item.pool).

 

Gk.

Gregor Kiddie
Senior Developer
INPS

Tel:       01382 564343

Registered address: The Bread Factory, 1a Broughton Street, London SW8
3QJ

Registered Number: 1788577

Registered in the UK

Visit our Internet Web site at www.inps.co.uk
<blocked::http://www.inps.co.uk/> 

The information in this internet email is confidential and is intended
solely for the addressee. Access, copying or re-use of information in it
by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
INPS or any of its affiliates. If you are not the intended recipient
please contact is.helpd...@inps.co.uk

________________________________

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of stinasius
Sent: 04 November 2009 13:31
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: multiple filter function of combobox and two
checkboxes

 

  

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.



Reply via email to