3 Replies Latest reply on Oct 21, 2012 11:00 PM by komal harkut

    how i do search in list with textinput

    lanky90 Level 1

      how i do search in list with textinput ?

       

      i make textinput with list and list have data i want to do search in list when right my information in textinput

        • 1. Re: how i do search in list with textinput
          komal harkut Level 1

          On change event of TextInput, apply a filter.I am giving sample code over here:

           

          private function filter():void {

                                                  (your list dataprovider).filterFunction = filterMyArrayCollection;

                                                   (your list dataprovider).refresh();

                                        }

           

                                        private function filterMyArrayCollection(item:Object):Boolean {

                                                  var searchString:String = (Your textinput id).text.toLowerCase();

                                                  var itemName:String = (item.(property of list provider which is to be searched) as String).toLowerCase();

                                                  return itemName.indexOf(searchString) > -1;

                                        }

           

          This will help you in following manner:

           

          when you type "D" in textinput, the list will show you the names which start with "D" or include the letter "D" in their spelling.

          • 3. Re: how i do search in list with textinput
            komal harkut Level 1

            If the asnwer was helpful/correct, please mark it correct, so that others can also benefit from the same.