2 Replies Latest reply on Aug 21, 2006 10:04 AM by GeorgeWS

    comboBox

    GeorgeWS Level 1
      I have a combo box like this:
      <mx:Script>
      <![CDATA[

      public var myfilter: Array = [ {label:"Product ID", data:1},
      {label:"Description", data:2}, {label:"Size", data:3}, {label:"Pack", data:4} ];

      public var selectedItem:Object;
      ]]>
      </mx:Script>


      <mx:ComboBox dataProvider="{myfilter}" width="125"
      close="selectedItem=ComboBox(event.target).selectedItem"/>

      I can find the label and the data but I want a third option what else can I use in my array: value?
      or can the data be anything like: pnum4w

      Hope this makes sence

      George
        • 1. Re: comboBox
          inlineblue Level 1
          The selectedItem property returns the entire object from the dataprovider array, eg. {label:"Product ID", data:1}. So you can put whatever you want in the object, not just label and data.
          • 2. Re: comboBox
            GeorgeWS Level 1
            how do you apply that? I have 2 scripts the first has a hard coded PDES5W, I want the second script (the one that fills the combobox) to effect the PDES5W so when I change the combo box the PDES5W becomes PNUM5W so I can filter on the product number instead of the description. can you show me how that would look?

            <mx:Script>
            <![CDATA[
            public function initApp():void
            {
            }

            public function processFilter(item:Object):Boolean
            {
            var result:Boolean=false;
            var pattern:RegExp= new RegExp("^"+txtFilter.text,"i");
            if (!item.PDES5W.length
            || item.PDES5W.match(pattern))
            result=true;

            return result;
            }
            ]]>
            </mx:Script>

            <mx:Script>
            <![CDATA[

            [Bindable]
            public var myfilter: Array = [ {label:"Product ID", data:1},
            {label:"Description", data:2}, {label:"Size", data:3}, {label:"Pack", data:4} ];

            [Bindable]
            public var selectedItem:Object;
            ]]>
            </mx:Script>

            Thanks
            George