1 Reply Latest reply on Aug 17, 2009 9:00 AM by Gregory Lafrance

    Simple question on ComboBox with dataProvider.

    karnatis Level 1

      Hi All,

       

         I'm new to flex. In my remote java class I'm returning java.util.List which is having State object.

       

         Example:

       

          List result = new ArrayList();

          State st = new State();

          st.addData("IL");

          st.addLabel("Illinois");

          result.add(st);

          st = new State();

          st.addData("VA");

          st.addLabel("Virginia");

          result.add(st);

       

       

      When I call this method for flex using remote object, and try to add below code

        

       

      <mx:ArrayCollection id="resultAC" source="{ArrayUtil.toArray(ro.getStateCodes.lastResult)}">

       

      </mx:ArrayCollection>

       

       

      <mx:ComboBox

       

      dataProvider="{resultAC}" />

       

       

       

      It is returning [object object],[object object]  in ComboBox. If I use same results in DataGrid dataProvider it is showing label and data correctly with below code

       

      <mx:DataGrid id="state" width="100%">

       

      <mx:columns>

       

      <mx:DataGridColumn dataField="label" headerText="Label"/>

       

      <mx:DataGridColumn dataField="data" headerText="Data"/>

       

      </mx:columns>

       

      </mx:DataGrid>

       

       

      Can someone please let me know, how to use dataProvdier in ComboBox.

       

       

       

       

      Thanks in advance.

       

       

       

      Regards,

      Sharath.