1 Reply Latest reply on Sep 29, 2008 3:39 AM by SujitG

    Changing variable with combobox selection - simple problem!

    jarmanje
      Hi there,

      I have a search field when you click on search.

      I want to make it so i can change which field in a datagrid you search for depending on the choice in the Combbox. I'm not sure how to set the object name correctly depending on the combobox selection.

      I tried it like this, to no avail


      private var acOrder:ArrayCollection

      private var currentOrder:Object;

      ///////////////this is incorrect. What should i use instead of Object?//////
      private var whichArray:Object
      /////////////

      private function makeid():void
      {
      whichArray = "orderid"
      }
      private function makeemail():void
      {
      whichArray = "email"
      }

      private function filterByOrderid(item:Object):Boolean
      {
      if (item.(whichArray) == filterTxt.text)

      ////I want this result to either be if (item.orderid == filterTxt.text)
      ///or if (item.orderid == filterTxt.email)
      {
      return true;
      }
      else
      {
      return false;
      }
      }

      private function doFilter():void
      {
      if (filterTxt.text.length == 0)
      {
      acOrder.filterFunction = null
      }
      else
      {
      acOrder.filterFunction = filterByOrderid;
      }
      acOrder.refresh()
      }



      i think answer is very simple. i just need to pass the name of the item inside the object correctly
      thanks very much for any help