Awesome , Cool I followed that and after little tweaks, it is working for me. Josh, David, Tracy and Alex , Thanks a lot for your help guys. I appreciate that Anuj
On Thu, Dec 4, 2008 at 3:07 PM, Josh McDonald <[EMAIL PROTECTED]> wrote: > Never bind to array, and also when you call array.filter() it will make > a duplicate Array, things you change there won't get changed in your source > (depending on references etc). You don't need to totally change your code, > just create a new ArrayCollection using your existing array as the source. > Whenever you add or delete items using the ArrayCollection, it will update > the Array for you, and when you set a filter on ArrayCollection it only > updates when it needs to, it's pretty smart. Then you just bind to the > ArrayCollection instead of the Array for the dataProvider of your List or > DataGrid or whatever. > > -Josh > > > On Fri, Dec 5, 2008 at 6:42 AM, anuj sharma <[EMAIL PROTECTED]> wrote: > >> Not with the above code >> Anuj >> >> >> On Thu, Dec 4, 2008 at 12:21 PM, Tracy Spratt <[EMAIL PROTECTED]>wrote: >> >>> Array is not bindable. Do you not get a warning? >>> >>> Tracy >>> >>> >>> ------------------------------ >>> >>> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On >>> Behalf Of *anuj sharma >>> *Sent:* Thursday, December 04, 2008 2:44 PM >>> *To:* flexcoders@yahoogroups.com >>> *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]> 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]> 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] >>> :: http://flex.joshmcdonald.info/ >>> :: http://twitter.com/sophistifunk >>> >>> >>> >>> >>> >>> >> > > > -- > "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] > :: http://flex.joshmcdonald.info/ > :: http://twitter.com/sophistifunk > >