Skip to main content
Inspiring
February 2, 2009
Question

ComboBox.selectedItem not binding to property in the Model

  • February 2, 2009
  • 2 replies
  • 2313 views
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 />}
This topic has been closed for replies.

2 replies

Inspiring
February 3, 2009
I added the Text control, and the value updates.

To fix this, I added an PropertyChangeEvent.PROPERTY_CHANGE Event Listener for the property that stores the Object that I want to be selected, and manually select it in ActionScript.




On Tue, Feb 3, 2009 at 4:14 AM, Tom Chiverton < member@adobeforums.com> wrote:



Add a simple Text control with text bound to the same property, see if that

updates.


Inspiring
February 3, 2009
On Monday 02 Feb 2009, Eric Belair wrote:

> selectedItem property is not being reset when the "selectedColumn" property

> in the Model is updated. I have debugged this, adding an Event Listener to



Add a simple Text control with text bound to the same property, see if that

updates.



--

Tom Chiverton



****************************************************



This email is sent for and on behalf of Halliwells LLP.



Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office together with a list of those non members who are referred to as partners. We use the word partner to refer to a member of the LLP, or an employee or consultant with equivalent standing and qualifications. Regulated by the Solicitors Regulation Authority.



CONFIDENTIALITY



This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500.



For more information about Halliwells LLP visit www.halliwells.com.