6 Replies Latest reply on May 12, 2009 2:23 PM by srini kusunam

    Setting Combobox 'dataProvider' @runtime and using 'labelFunction'

    srini kusunam

      I have 2 comboboxes which are related i.e. when i change cb-1 i need to display values in cb-2 (cb-2 list varies with the value selected). I have simplified my case but this is what my problem is. After i set 'cb-2.dataProvider' when does 'labelFunction' for cb-2 get called?

       

      If i am not clear enough please let me know. Here is the code.....

       

       

       

       

       

      private function cb-1Change(event:ListEvent):void

      {

      // This will be a dynamic one using the value selected in cb-1

       

      cb-2.dataProvider = __model.someList.getItemAt(0).cb-2VOList;  // extracting from a Map kind object

      }

       

      // This Label function is never getting called

       

       

       

       

       

       

      private function displayCB-2Label(item:Object):String{

       

       

           // something

      }

       

       

       

       

       

       

       

      <mx:ComboBox d="cb-1"

                dataProvider="

      {__model.cb-1List}"

                change="cb-1Change(event)"

      />

       

       

       

      <mx:ComboBox d="cb-2"

                labelFunction="displayCB-2Label(event)"

       

       

                change="cb-1Change(event)"

      />

       

                change="cb-1Change(event)"

      />