Hi,

There's a few problems with your original code.  First, pizzaSelected
will never change after the first click of the CheckBox; because you're
only setting it if the CheckBox is selected.  Also not sure why you
don't just use pizzaSelected = pizza_ckb.selected; instead of
pizza_ckb.data, or why use a reference variable at all.  Second, you're
trying to compare String values to Boolean values.  Boolean values are
sometimes stored as varchar, int, or bit in a database.  Once the data
gets to the client, you need to make sure that you are either casting
these values to Boolean, or comparing them to similar data types; in
this case it looks like String.  If you are using strings, also be
careful of spelling and case.  Finally, you only need to use refresh()
once; after a sort or filterFunction has been applied to a collection.

Give this code a whirl:
<---------------------------------------------------------------->

private var pizzaSelected:String;



private function pizzaFilter():void
{
      pizzaSelected = pizza_ckb.selected ? "yes" : "no" ;
      filterGrid();
}

private function filterGrid() :void
{
      // this assumes that you want to show all; if pizza_chb is not
selected
     pizzaAr.filterFunction = (pizzaSelected == "yes") ? myFilterFunction
: null;
     pizzaAr.refresh();
}



private function myFilterFunction(item:Object): Boolean
{
      return (item.pizza.toLowerCase() == pizzaSelected) ;
}

-TH

--- In [email protected], "johndoematrix" <johndoemat...@...>
wrote:
>
> i have tried every advise provide so far and still doesn't work. this
> is the senario, in my database i have a column(Field Name) for pizza
> with Data Type "YES/NO". i display everything in a flex app through a
> arraycollection and want to filter that data. i use a checkbox to
> filter data if there is pizza or not. when the pizza checkbox is
> checked i want to show only entries with pizza. hope that details what
> i wanna do.
>


Reply via email to