1 Reply Latest reply on Jun 24, 2010 9:30 AM by rtalton

    Datagrid Search working, but need to expand !

    djh88ukwb Level 1

      Hello all.

      I am using the following code, to search thru a datagrid, with data being pulled in from a database.

       

      Here is the text area

      <s:TextInput width="145" id="firstNameSearchBox" change="firstNameSearchBoxFilter()"/>

      Here is the script

              private function firstNameSearchBoxFilter():void
                  {               
                      surnameSearchBox.text = "";
                      availablerecruitersdg.dataProvider.filterFunction = firstNameSearch;
                      availablerecruitersdg.dataProvider.refresh();
                  }
                  private function firstNameSearch(item:Object):Boolean
                  {
                      var isMatch:Boolean = false
                      if(item.firstname.toString().toLowerCase().search(firstNameSearchBox.text.toString().toLo werCase()) != -1)
                      {
                          isMatch = true
                      }
                      return isMatch;             
                  }

       

      Now this works fine, searches for the firstname, but i want to expand this search, so one search box looks for both "firstname" "secondname" and "email".  No matter what i tried i couldnt get it going.  Any suggestions ?