Array is not bindable.  Do you not get a warning?

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of anuj sharma
Sent: Thursday, December 04, 2008 2:44 PM
To: [email protected]
Subject: Re: [flexcoders] Fwd: Filtering the List Entries depending upon
the text entered in text Input box

 

I would be able to successfully implement the same code with Array
instead of ArrayCollection but there is no method name array.refresh,
However there is method named ArrayCollection.refresh which is
responsible for refreshing my list. How do I refresh my array?Does
anybody know equivalent method to refresh array in the list? Below is
the code except in the processfilter I need to refresh array.
Thanks for your help
Anuj
/***************************CODE*************************/

<mx:Script>
        <![CDATA[            
            
            import mx.managers.PopUpManager;
            import mx.effects.DefaultTileListEffect;          
            import mx.rpc.events.ResultEvent;
            import mx.controls.Alert;
            import mx.collections.ArrayCollection;
            import mx.effects.easing.Elastic;
        
            [Bindable]
            public var ac:ArrayCollection = new
ArrayCollection(["One-Device","Two-Device","Three-Device","Four-Device",
"Five-Device","Six-Device"]);
            [Bindable]
              public var arr:Array=["One","Second","Third"];
            [Bindable]
            public var filterText:String = '';
                        
            private function doChange():void
            {
                this.filterText = txtSearch.text;              
                //this.ac.refresh();
            }
            
            private function init():void
            {
                arr.filter(processFilter);
            }
            private function processFilter(item:Object,index:int,
array:Array):Boolean
            {
                return
String(item).toUpperCase().indexOf(filterText.toUpperCase()) >= 0;
         
            }
            private function seeLabel(evt:Event):void
            {
                var alrt:Alert=Alert.show(evt.currentTarget.toString());
            }

        ]]>
</mx:Script>
    <mx:List x="74" y="228" width="229" height="238"
dataProvider="{arr}" id="DevicesList"></mx:List>
    <mx:TextInput x="74" y="198" id="txtSearch" change="doChange()"/>
    

On Thu, Dec 4, 2008 at 11:05 AM, anuj sharma <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

Hi Josh
Thanks a lot, That works perfectly for my arrayCollection. Now I already
have a project in which the data provider for my List is Array and I
need the same filter functionality for the Array. can we do this filter
for Array too or do i have to change the code of my project and instead
of array I need to store complete data in ArrayCollection instead of
Array and then made that filter working. It's just lot of work to change
the existing workign code with my harsh deadline.
Please let me know which is the best way.
Again I highly appreciate your help
Anuj

 

On Wed, Dec 3, 2008 at 7:25 PM, Josh McDonald <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

        private function processFilter(item:Object):Boolean
        {

            return
String(item).toUpperCase().indexOf(filterText.toUpperCase()) >= 0;
        }

-Josh

-- 
"Therefore, send not to know For whom the bell tolls. It tolls for
thee."

Like the cut of my jib? Check out my Flex blog!

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
:: http://flex.joshmcdonald.info/ <http://flex.joshmcdonald.info/> 
:: http://twitter.com/sophistifunk <http://twitter.com/sophistifunk> 

 

 

 

Reply via email to