Each of the items passed to the filter function should be objects from
your data provider. You should be able to use one filter function for
both criteria...

private function applyColourAndSizeFilter(item:Object):Boolean
{
     if(item.colour == "All colours" && item.size == 12)
     {
         return true;
     }
     return false;
}


--- In [email protected], "munene_uk" <munene.anth...@...>
wrote:
>
> does anyone have any examples of how i can create multiple filters for
use in two comboboxes for one datagrid? seems my implementation only
filters on one but not both e.g if i select items that are size 12 i
cant further select size 12 items that are black... AS3 code below
>
> private function filterColourData():void
>             {
>
>              xmlData2.filterFunction = applyColourFilter;
>              xmlData2.refresh()
>              Alert.show(xmlData2.length.toString());
>
>             }
>   public function applyColourFilter(item:Object):Boolean
>   {
>
>    if(colourFilter.selectedItem == "All colours")
>    {
>     return true
>
>    }
>
>    else
>    {
>    return item.colour == colourFilter.selectedItem;
>
>    }
>
>
>
>
>
>
>   }
>
>
>    private function filterSizeData():void
>             {
>
>              xmlData2.filterFunction = applySizeFilter;
>              xmlData2.refresh()
>              Alert.show(xmlData2.length.toString());
>
>             }
>   public function applySizeFilter(item:Object):Boolean
>   {
>
>
>    if(sizeFilter.selectedItem == "All sizes")
>    {
>     return true
>    }
>    else
>    {
>    return item.sizes == sizeFilter.selectedItem;
>
>    }
>
>
>
>
>   }
>


Reply via email to