0 Replies Latest reply on May 26, 2007 10:42 PM by HyderAlamgir

    dataProvider for List not working

    HyderAlamgir Level 1
      The dataProvider command below is not working
      the SQL command returns the query as label like,

      select username as lable from t_user;


      package components
      {
      import mx.controls.List;
      import mx.events.FlexEvent;
      import data.Model;
      import events.dataReceivedEvent;

      //temp imports

      import mx.controls.Alert;

      public class ListEmployeeDataClass extends List {


      private var _model:Model;


      public function ListEmployeeDataClass() {

      super();

      }

      public function creationCompleteHandler (event:FlexEvent):void {

      }

      public function getUserNames ():void {

      _model=new Model;
      _model.getUserNames();

      _model.addEventListener(dataReceivedEvent.USERNAMES, populateList);

      }

      private function populateList (event:dataReceivedEvent):void {

      Alert.show(event.dataArrColl.getItemAt(0).label); // OUTPUTS FIRST USERNAME!!! THIS DOES GET CALLED!
      this.dataProvider=event.dataArrColl; //THIS DOES NOT POPULATE THE LIST... WHY?!

      }

      }
      }