Question
ComboBox.selectedItem not binding to property in the Model
Can someone please explain to me why this is not working??? The selectedItem property is not being reset when the "selectedColumn" property in the Model is updated. I have debugged this, adding an Event Listener to the Model for PropertyChangeEvent.PROPERTY_CHANGE Events, and I verified that the property IS being udpated. I event tried calling validateNow() and invalidateDisplayList() for the ComboBox component, but it does nothing. In the debugger the "selectedItem" property is "null".<br /><br />Here is pseudo-code showing my ComboBox component and Model. Why is the selectedItem not binding the property in the Model???<br /><br /><?xml version="1.0" encoding="utf-8"?><br /><mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml" <br /> dataProvider="{__model.columns}" <br /> rowCount="{__model.columns.length}" <br /> selectedItem="{__model.selectedColumn}"><br /> <mx:Script><br />...<br /> [Bindable]<br /> private var __model:ModelLocator = ModelLocator.getInstance();<br />...<br /> </mx:Script><br /></mx:ComboBox><br /><br />package model<br />{<br /> import mx.collections.ArrayCollection;<br /> <br /> [Bindable]<br /> public class ModelLocator extends EventDispatcher<br /> {<br /> static public var __instance:ModelLocator = null;<br /> <br /> public var columns:ArrayCollection;<br /> <br /> public var selectedColumn:Object;<br /> <br /> static public function getInstance():ModelLocator<br /> {<br /> if (__instance == null)<br /> __instance = new ModelLocator();<br /> <br /> return __instance;<br /> }<br /> }<br />}
