tags:

views:

163

answers:

1

Hi All ,

I was trying to get an object from backend which inturn consists of several object and I was trying to filter the object and assing it to the combobox , But I was getting [object object] .Can somebody please look at the code and let me know where it went wrong.

  public function init():void {

      measureTypesList = model.Lookups.getInstance().measureTypesList;
      measureTypesList.filterFunction =  measureTypeFilter;    
      measureTypesList.refresh();    

      measureTypesListCombo.dataProvider =  measureTypesList; 
      invalidateProperties();
      measureTypesList.dispatchEvent(new CollectionEvent("COLLECTION_CHANGE")); 


  }  

  private function measureTypeFilter(item:Object):String
  {
   trace(" The Value of Measure Type Filter IS "+item.MEASURE_TYPE);
   return  item.MEASURE_TYPE;
  }    


    <mx:ComboBox id="measureTypesListCombo" width="200" />   

    object structure is like object 
                                   [ object[1] - which inturn consists of MEASURE_ID and something like that ] .There would be several objects like this .

THANKS , SUDEEP

A: 

This is usually called by the combobox not being able to understand what to do with the data it's given.

It looks like you're writing AS3, and in that case the combobox is expecting each element in the DataProvider to have a property named "label" - this is what will be displayed in the combobox.

You may want to create your own instance of DataProvider and then manually add your data from the server to it (making sure to set the proper label and data properties of each element). Then you'd simply need to give that instance of DataProvider to your combobox.

Branden Hall