If you run the sample code below and click the "Update Filter" button,
both lists get filtered but I only want the one on the right to be
filtered.  I have two ArrayCollections, one bound to the other via
BindingUtils and I didn't expect that filtering the target AC would
also filter the source AC.  In other words, I assumed the notification
of change events was a one-way street from source to target.  How
would you approach this problem?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" creationComplete="init()">
<mx:Script>
        <![CDATA[
                import mx.binding.utils.BindingUtils;
                import mx.collections.ArrayCollection;
        
                [Bindable]
                public var bindingSource:ArrayCollection = new ArrayCollection(
                                        [
                                                new ObjectProxy({label:'tom', 
sex:"M"}),
                                                new ObjectProxy({label:'steve', 
sex:"M"}),
                                                new ObjectProxy({label:'suzy', 
sex:"F"}),
                                                new ObjectProxy({label:'megan', 
sex:"F"})
                                        ]);
                
                [Bindable]
                public var bindingTarget:ArrayCollection;       
                
                private function init():void
                {                       
                        BindingUtils.bindProperty( this, "bindingTarget", this, 
["bindingSource"] );
                        bindingTarget.filterFunction = genderFilter;
                }       
        
        private function genderFilter(element:*):Boolean
        {
                var result:Boolean = false;
                
                if( element.sex == "F")
                {
                        result = true;
                }
                
                return result;
        }                       
        ]]>
</mx:Script>
<mx:Canvas backgroundColor="#ffffff">
        <mx:HBox>
                <mx:VBox borderStyle="solid">
                        <mx:Text width="200" height="50" text="I want this list 
to NOT be filtered"/>
                        <mx:List dataProvider="{bindingSource}" width="200"/>
                </mx:VBox>
                <mx:VBox>
                        <mx:Text width="200" height="50" text="I want this list 
to be a
filtered subset of the list on the left"/>
                        <mx:List dataProvider="{bindingTarget}" width="200"/>
                </mx:VBox>
                <mx:Button label="Update Filter" 
click="bindingTarget.refresh()"/>
        </mx:HBox>              
</mx:Canvas>
</mx:Application>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
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/

<*> 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