1 Reply Latest reply on Aug 16, 2010 10:12 PM by Subeesh Arakkan

    How to display Selected data from TextInput  only should be displayed in DataGrid

    kiran7881 Level 1

      Hi ,

       

      I have lot of data on to my Datarid displayed with the help of An ArrayCollection as dataprovider .
      I want to use filtering Functionality of ArrayList .
      I have  a TextInput and when the suer enters some text , then i want only related data shpould only be displayed on to the DataGrid .
      I have tried this  , but i have struck up

       

       

      This is my ArrayCollection

       

      <mx:ArrayCollection id="arraycoll">

       

          <mx:Object>
              <mx:name>Ravi</mx:name>
              <mx:pass>Keyboard</mx:pass>
          </mx:Object>
         
              <mx:Object>
              <mx:name>Kiran</mx:name>
              <mx:pass>Keyboard</mx:pass>
          </mx:Object>

       

      <mx:ArrayCollection>

       

      This is my DataGrid

       

      <mx:DataGrid dataProvider="{arraycoll}" x="329" y="199" width="300" height="300" visible="true" >

       

       

      public function SearchData():void

      {

      arraycoll.filterFunction = doFilter;

      }

         private function doFilter(item:Object):Boolean {
                      var searchString:String = myTextIp.text.toLowerCase();

       

      // Need logic here
                              }

       

       

      <mx:TextInput id="myTextIp" name="SeacrhName"  change="SearchData()">

       

      For example if the user presses Ra on to TextInput then i want to display only as Ravi on to DataGrid .

      Please help .