Hi all - I'm trying to mix together two blocks of code:

Ben Forta's "As you type" Grid filtering:
http://www.forta.com/blog/index.cfm/2006/7/13/Filtering-Data-In-Flex

Filter a Grid with Combobox:
http://www.cflex.net/showFileDetails.cfm?
ObjectID=415&Object=File&ChannelID=1

I have successfully implemented either one or the other, but can't 
quite get both to work at the same time.  What I have so far is 
below.  The application has a datagrid's dataProvider bound 
to "objectList" - it has an objName field for text search and a 
typeName field for the combobox.

The combobox is "cbTypeList" and the textinput is "searchText.text."  
Both have change="objectList.refresh()"

If I use the code below, the combobox still filters, but the textbox 
typing does not.  If I remove either set's function, they each work 
fine on their own.

private function resultHandlerGetAllObjects(event:ResultEvent):void {
        objectList = event.result as ArrayCollection;
        objectList.filterFunction=processFilter;
        objectList.filterFunction=typeFilter;
}
/* http://www.forta.com/blog/index.cfm/2006/7/13/Filtering-Data-In-
Flex */
private function processFilter(item:Object):Boolean {
        var result:Boolean=false;

        if (item.objName.length == 0 || item.objName.toUpperCase
().indexOf(searchText.text.toUpperCase()) >= 0) {
                result=true;
        }
        return result;
}
/* http://www.cflex.net/showFileDetails.cfm?
ObjectID=415&Object=File&ChannelID=1 */
private function typeFilter(item:Object):Boolean {
        var result:Boolean=false;
        if(item.typeName == cbTypeList.selectedItem.typeName) {
                result=true;
        }
        return result;
}





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to