vendredi 19 février 2016

Issue with bidirectional data binding (using a DropDownList)

I'm having an issue with bidirectional data binding using a DropDownListin a custom ItemRenderer and none of the existing answers here have helped (ex: in Flex DropDownList, is there a way to bind to a property of an item in dataProvider?). I am updating a legacy Flex project and maybe my understanding of data binding has rusted.

I have the DropDownList as defined below.

  • dataProvider is a Bindable ArrayList of custom Class instances
  • labelField references a Bindable String property named "subMenuID" of the custom Class
  • selectedItem references a Bindable String property named "subMenu" in a custom Class instance being referenced by the itemRenderer

The functionality is simply to:

  • show the current value of "data.subMenu" as the selectedItem
  • enable the user to change it through a DropDownList selection

What is happening is that "data.subMenu" is being set to null for some reason and the selectedItem is always blank.

I think I have everything that needs to be Bindable marked as such and accessible (e.g. public). Not getting any error messages. Am I missing something obvious?


<s:DropDownList id="subMenuSelector" 
                width="120" 
                dataProvider="{studioData.subMenus}"
                labelField="subMenuID"
                selectedItem="@{data.subMenu}"
                enabled="true"/>

Aucun commentaire:

Enregistrer un commentaire