Why not just do all the logic in the filter fuction?

 

Tracy Spratt 
Lariat Services 

Flex development bandwidth available 

________________________________

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of m_ba...@goodyear.com
Sent: Friday, February 20, 2009 11:08 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Multiple filters on datagrid

 


I have four comboboxes populated from arrays. I have a datagrid
populated by an ArrayCollection. I can filter the ArrayCollection from
each combo box individually, but I need to filter by multiple
selections. For example, I may want to filter by UserID and Carrier and
Origin. 

The obvious solution is to run a conditional that appends a variable and
use the variable in the filter conditional. 

if(cboUserID.text != ""){ 
        filterVar = 'item.USER_ID == cboUserID.text';         
} 
if(cboCarrier.text != ""){ 
        filterVar = filterVar + 'item.Carrier == cboCarrier.text';

} 

public function processFilters(item: Object):Boolean { 
if (filterVar.toString()) { 
                  return true;} 
                  {         
          

                return false; 
   }                 


The problem is that the processFilters function won't accept the
filterVar as a string. Is it a matter of using a different datatype or
do I need to escape characters or is this not possible? Is there a
better way to do this? 


Thanks,
Mike Baker
m_ba...@goodyear.com



Reply via email to