It’s just an ordering problem.  The bindings from the checkbox to the data object are executing before the binding from the data to the checkbox.  So the checkbox is winning this little fight.  It’s definitely an annoyance, you’d like the data to take priority over the UI that’s representing it, but the binding mechanism doesn’t really think that way, it just assigns when it’s told to.  So I don’t really have an answer for you here, you’ll just need to use one of the workarounds you’ve come up with.

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of Jaime Bermudez
Sent: Thursday, October 27, 2005 9:15 PM
To: [email protected]
Subject: Re: [flexcoders] issue w/ two-way binding on checkboxes and radiobuttons?

 

As a follow-up, in the example provided the bindings work fine if the mx:Binding tags are commented out.  The bindings also work if the initObj() method is called on a childrenCreated event of the Application, which I don't understand.  Any idea on what's going on?

 

On 10/27/05, Matt Chotin <[EMAIL PROTECTED]> wrote:

The ViewStack might have something to do with it.  Can you create a full example that shows the problem?

 


From: [email protected] [mailto:[email protected]] On Behalf Of Jaime Bermudez
Sent: Thursday, October 27, 2005 12:59 PM
To: [email protected]
Subject: [flexcoders] issue w/ two-way binding on checkboxes and radiobuttons?

 

I'm wondering if any other flexcoders have come across this issue.  I have a Panel component within an auto Viewstack (not sure if the Viewstack is causing anything).  The panel has an activate() method that gets hit once the viewstack index selects - the activate method is where remote data calls are being made.  So, basically the Panel is a view for a data object.  I use two-way binding to set various controls ( e.g. checkboxes, radiobuttons) that reflect fields on the object.  Here's an example:

 

 <mx:Binding source="chkField1.selected" destination="dataObject.Field1"/>
 

  <mx:CheckBox id="chkField1" label="Field 1" selected="{dataObject.Field1}" click="formHasChanged()"/>

 

What I'm finding is that the first time the Panel is hit, the selected property isn't set correctly, but on subsequent visits to the component the binding works fine.  The checkbox binding works fine if I don't include the mx:Binidng object, but the binding object is convenient for dealing w/ saves ( i.e. I can send the dataObject directly).  I ended up creating custom Checkboxes, RadioButtons, and ComboBoxes that have a duplicate selected or selectedItem field that I can use in the Binding object, but I was just wondering if there was another way around this.  Is this a FLEX bug?

 

Thanks,

 

Jaime




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



SPONSORED LINKS

Web site design development

Computer software development

Software design and development

Macromedia flex

Software development best practice

 

 


YAHOO! GROUPS LINKS

 

 






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to