Re: [flexcoders] Re: binding not updating for ArrayCollection when item changes?

2009-03-13 Thread John Robinson
Thanks Josh! I haven't tried to implement this yet but so far it makes  
sense.


Thanks again,
John


On Mar 12, 2009, at 9:01 PM, Josh McDonald wrote:


In your custom control, change this:


public function set dataProvider(dp:ArrayCollection):void {
_dp = dp;
	trace(this fires when the AC is created, but not when it's  
contents change);	

}

to something like this:


public function set dataProvider(value : ArrayCollection) : void
{
if (_dp == value)
return;

if (dataProvider)
 
dataProvider.removeEventListener(CollectionEvent.COLLECTION_CHANGE,  
handleUpdatedProvider);


_dp = value;

if (dataProvider)
 
dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE,  
handleUpdatedProvider, ???, ???, true); // Weak listener!


handleUpdatedProvider(null);
}

private function handleUpdatedProvider(event : CollectionEvent) : void
{
//... do stuff
}


Note that this is just typed out of the top of my head, probably  
full of typos, and you need to put the default options in place of  
??? when attaching the listener :)


-Josh


2009/3/13 John Robinson jrobi...@nycap.rr.com
Yeah, I've been directly updating the properties. Here's the weird  
part... if I use the ArrayCollection as a dataProvider for a List  
control, it updates. If I use it for a custom control that I've  
created, it does not.



Example:

This works as expected:
mx:List dataProvider={model.users}/

This does not:
jr:customComponent dataProvider={model.users}/

//pseudo component source
customComponent
mx:Script
private var _dp:ArrayCollection;

public function set dataProvider(dp:ArrayCollection):void {
_dp = dp;
	trace(this fires when the AC is created, but not when it's  
contents change);	

}

/mx:Script
/customComponent

Thanks again!
John

On Mar 10, 2009, at 4:44 PM, valdhor wrote:

How do you update a given UserVO's userData? Do you directly access  
the public properties?


I have never done it this way - I use getters and setters...

package com.jrobinson.model.VO
{
[Bindable]
public class UserVO
{
private var _id:int = -1;
private var _username:String = null;
private var _enabled:Boolean = false;
private var _userData:XMLList = null;

public function UserVO(id:int, username:String,  
enabled:Boolean, userData:XMLList)

{
_id = id;
_username = username;
_enabled = enabled;
_userData = userData;
}

//accessor methods
public function get id():int {return _id;}
public function get username():String {return _username;}
public function get enabled():Boolean {return _enabled;}
public function get userData():XMLList {return _userData;}

//mutator methods
public function set id(id:int):void {_id = id;}
public function set username(username:String):void  
{_username = username;}
public function set enabled(enabled:Boolean):void {_enabled  
= enabled;}
public function set userData(userData:XMLList):void  
{_userData = userData;}

}
}


  I have a strange issue with data binding not updating when an  
item in

  an ArrayCollection is changed. I'm using Cairngorm and have the
  following setup. In my ModelLocator I have a 'users'  
ArrayCollection
  that contains 'UserVO' objects. I have a two views that binds  
their
  dataProvider to the 'users' AC in the ModelLocator. My UserVO  
looks

  like so:
 
  package com.jrobinson.model.VO
  {
  [Bindable]
  public class UserVO
  {
  public var id:int = -1;
  public var username:String = null;
  public var enabled:Boolean = false;
  public var userData:XMLList = null;
 
 
  public function UserVO(user_id:int, uName:String,  
enabled:Boolean,

  d:XMLList)
  {
  id = user_id;
  username = uName;
  enabled = enabled;
  userData = d;
  }
 
  }
  }
 
  I first have a command that loads all of the users and  
populates the

  AC. This updates the bindings as expected. I then have a second
  command that loads the userData portion for a given user. Once
  retrieved, I update the given UserVO's userData, but this  
time, the

  bindings fail to update.
 
  I feel like I've seen this before but can't find where or what  
the
  workaround might be. I guess I'm just looking for confirmation  
that

  this should or shouldn't work.
 
  Thanks!
  John
 





--
Therefore, send not to know For whom the bell tolls. It tolls for  
thee.


Josh 'G-Funk' McDonald
  -  j...@joshmcdonald.info
  -  http://twitter.com/sophistifunk
  -  http://flex.joshmcdonald.info/








Re: [flexcoders] Re: binding not updating for ArrayCollection when item changes?

2009-03-12 Thread John Robinson
Yeah, I've been directly updating the properties. Here's the weird  
part... if I use the ArrayCollection as a dataProvider for a List  
control, it updates. If I use it for a custom control that I've  
created, it does not.


Example:

This works as expected:
mx:List dataProvider={model.users}/

This does not:
jr:customComponent dataProvider={model.users}/

//pseudo component source
customComponent
mx:Script
private var _dp:ArrayCollection;

public function set dataProvider(dp:ArrayCollection):void {
_dp = dp;
	trace(this fires when the AC is created, but not when it's contents  
change);	

}

/mx:Script
/customComponent

Thanks again!
John

On Mar 10, 2009, at 4:44 PM, valdhor wrote:

How do you update a given UserVO's userData? Do you directly access  
the public properties?


I have never done it this way - I use getters and setters...

package com.jrobinson.model.VO
{
[Bindable]
public class UserVO
{
private var _id:int = -1;
private var _username:String = null;
private var _enabled:Boolean = false;
private var _userData:XMLList = null;

public function UserVO(id:int, username:String,  
enabled:Boolean, userData:XMLList)

{
_id = id;
_username = username;
_enabled = enabled;
_userData = userData;
}

//accessor methods
public function get id():int {return _id;}
public function get username():String {return _username;}
public function get enabled():Boolean {return _enabled;}
public function get userData():XMLList {return _userData;}

//mutator methods
public function set id(id:int):void {_id = id;}
public function set username(username:String):void  
{_username = username;}
public function set enabled(enabled:Boolean):void {_enabled  
= enabled;}
public function set userData(userData:XMLList):void  
{_userData = userData;}

}
}


  I have a strange issue with data binding not updating when an  
item in

  an ArrayCollection is changed. I'm using Cairngorm and have the
  following setup. In my ModelLocator I have a 'users'  
ArrayCollection
  that contains 'UserVO' objects. I have a two views that binds  
their
  dataProvider to the 'users' AC in the ModelLocator. My UserVO  
looks

  like so:
 
  package com.jrobinson.model.VO
  {
  [Bindable]
  public class UserVO
  {
  public var id:int = -1;
  public var username:String = null;
  public var enabled:Boolean = false;
  public var userData:XMLList = null;
 
 
  public function UserVO(user_id:int, uName:String,  
enabled:Boolean,

  d:XMLList)
  {
  id = user_id;
  username = uName;
  enabled = enabled;
  userData = d;
  }
 
  }
  }
 
  I first have a command that loads all of the users and  
populates the

  AC. This updates the bindings as expected. I then have a second
  command that loads the userData portion for a given user. Once
  retrieved, I update the given UserVO's userData, but this time,  
the

  bindings fail to update.
 
  I feel like I've seen this before but can't find where or what  
the
  workaround might be. I guess I'm just looking for confirmation  
that

  this should or shouldn't work.
 
  Thanks!
  John
 


Re: [flexcoders] Re: binding not updating for ArrayCollection when item changes?

2009-03-12 Thread Josh McDonald
In your custom control, change this:


public function set dataProvider(dp:ArrayCollection):void {
_dp = dp;
trace(this fires when the AC is created, but not when it's contents
change);
}

to something like this:


public function set dataProvider(value : ArrayCollection) : void
{
if (_dp == value)
return;

if (dataProvider)
dataProvider.removeEventListener(CollectionEvent.COLLECTION_CHANGE,
handleUpdatedProvider);

_dp = value;

if (dataProvider)
dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE,
handleUpdatedProvider, ???, ???, true); // Weak listener!

handleUpdatedProvider(null);
}

private function handleUpdatedProvider(event : CollectionEvent) : void
{
//... do stuff
}


Note that this is just typed out of the top of my head, probably full of
typos, and you need to put the default options in place of ??? when
attaching the listener :)

-Josh


2009/3/13 John Robinson jrobi...@nycap.rr.com

   Yeah, I've been directly updating the properties. Here's the weird
 part... if I use the ArrayCollection as a dataProvider for a List control,
 it updates. If I use it for a custom control that I've created, it does
 not.

 Example:
 This works as expected:
 mx:List dataProvider={model.users}/

 This does not:
 jr:customComponent dataProvider={model.users}/

 //pseudo component source
 customComponent
 mx:Script
 private var _dp:ArrayCollection;

 public function set dataProvider(dp:ArrayCollection):void {
 _dp = dp;
 trace(this fires when the AC is created, but not when it's contents
 change);
 }

 /mx:Script
 /customComponent

 Thanks again!
 John

 On Mar 10, 2009, at 4:44 PM, valdhor wrote:

 How do you update a given UserVO's userData? Do you directly access the
 public properties?

 I have never done it this way - I use getters and setters...

 package com.jrobinson.model.VO
 {
 [Bindable]
 public class UserVO
 {
 private var _id:int = -1;
 private var _username:String = null;
 private var _enabled:Boolean = false;
 private var _userData:XMLList = null;

 public function UserVO(id:int, username:String, enabled:Boolean,
 userData:XMLList)
 {
 _id = id;
 _username = username;
 _enabled = enabled;
 _userData = userData;
 }

 //accessor methods
 public function get id():int {return _id;}
 public function get username():String {return _username;}
 public function get enabled():Boolean {return _enabled;}
 public function get userData():XMLList {return _userData;}

 //mutator methods
 public function set id(id:int):void {_id = id;}
 public function set username(username:String):void {_username =
 username;}
 public function set enabled(enabled:Boolean):void {_enabled =
 enabled;}
 public function set userData(userData:XMLList):void {_userData =
 userData;}
 }
 }


   I have a strange issue with data binding not updating when an item in
   an ArrayCollection is changed. I'm using Cairngorm and have the
   following setup. In my ModelLocator I have a 'users' ArrayCollection
   that contains 'UserVO' objects. I have a two views that binds their
   dataProvider to the 'users' AC in the ModelLocator. My UserVO looks
   like so:
  
   package com.jrobinson.model.VO
   {
   [Bindable]
   public class UserVO
   {
   public var id:int = -1;
   public var username:String = null;
   public var enabled:Boolean = false;
   public var userData:XMLList = null;
  
  
   public function UserVO(user_id:int, uName:String, enabled:Boolean,
   d:XMLList)
   {
   id = user_id;
   username = uName;
   enabled = enabled;
   userData = d;
   }
  
   }
   }
  
   I first have a command that loads all of the users and populates the
   AC. This updates the bindings as expected. I then have a second
   command that loads the userData portion for a given user. Once
   retrieved, I update the given UserVO's userData, but this time, the
   bindings fail to update.
  
   I feel like I've seen this before but can't find where or what the
   workaround might be. I guess I'm just looking for confirmation that
   this should or shouldn't work.
  
   Thanks!
   John
  

  




-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

Josh 'G-Funk' McDonald
  -  j...@joshmcdonald.info
  -  http://twitter.com/sophistifunk
  -  http://flex.joshmcdonald.info/


[flexcoders] Re: binding not updating for ArrayCollection when item changes?

2009-03-10 Thread valdhor
I don't know if this is your problem but one thing I noticed is youu have an 
ambiguous set of your enabled property. You have 

enabled = enabled;

which (I assume) is to set the enabled property of your class to the enabled 
parameter that is passed in. This won't work. You should have

this.enabled = enabled;

or change one of the parameter names.

--- In flexcoders@yahoogroups.com, John Robinson jrobi...@... wrote:

 I have a strange issue with data binding not updating when an item in  
 an ArrayCollection is changed. I'm using Cairngorm and have the  
 following setup. In my ModelLocator I have a 'users' ArrayCollection  
 that contains 'UserVO' objects. I have a two views that binds their  
 dataProvider to the 'users' AC in the ModelLocator. My UserVO looks  
 like so:
 
 package com.jrobinson.model.VO
 {
   [Bindable]
   public class UserVO
   {
   public var id:int = -1;
   public var username:String = null;
   public var enabled:Boolean = false;
   public var userData:XMLList = null;
   
   
   public function UserVO(user_id:int, uName:String, 
 enabled:Boolean,  
 d:XMLList)
   {
   id = user_id;
   username = uName;
   enabled = enabled;
   userData = d;
   }
 
   }
 }
 
 I first have a command that loads all of the users and populates the  
 AC. This updates the bindings as expected. I then have a second  
 command that loads the userData portion for a given user. Once  
 retrieved, I update the given UserVO's userData, but this time, the  
 bindings fail to update.
 
 I feel like I've seen this before but can't find where or what the  
 workaround might be. I guess I'm just looking for confirmation that  
 this should or shouldn't work.
 
 Thanks!
 John





Re: [flexcoders] Re: binding not updating for ArrayCollection when item changes?

2009-03-10 Thread John Robinson
Nice catch! That didn't seem to be causing the problem but thanks for  
pointing it out.

I've simplified the case in that I'm not calling the web service  
anymore, just flipping the enabled property but binding still is not  
updating. Any other ideas?

Thanks,
John

On Mar 10, 2009, at 10:53 AM, valdhor wrote:

 I don't know if this is your problem but one thing I noticed is youu  
 have an ambiguous set of your enabled property. You have

 enabled = enabled;

 which (I assume) is to set the enabled property of your class to the  
 enabled parameter that is passed in. This won't work. You should have

 this.enabled = enabled;

 or change one of the parameter names.

 --- In flexcoders@yahoogroups.com, John Robinson jrobi...@... wrote:

 I have a strange issue with data binding not updating when an item in
 an ArrayCollection is changed. I'm using Cairngorm and have the
 following setup. In my ModelLocator I have a 'users' ArrayCollection
 that contains 'UserVO' objects. I have a two views that binds their
 dataProvider to the 'users' AC in the ModelLocator. My UserVO looks
 like so:

 package com.jrobinson.model.VO
 {
  [Bindable]
  public class UserVO
  {
  public var id:int = -1;
  public var username:String = null;
  public var enabled:Boolean = false;
  public var userData:XMLList = null;
  
  
  public function UserVO(user_id:int, uName:String, 
 enabled:Boolean,
 d:XMLList)
  {
  id = user_id;
  username = uName;
  enabled = enabled;
  userData = d;
  }

  }
 }

 I first have a command that loads all of the users and populates the
 AC. This updates the bindings as expected. I then have a second
 command that loads the userData portion for a given user. Once
 retrieved, I update the given UserVO's userData, but this time, the
 bindings fail to update.

 I feel like I've seen this before but can't find where or what the
 workaround might be. I guess I'm just looking for confirmation that
 this should or shouldn't work.

 Thanks!
 John





 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo 
 ! Groups Links






John Robinson - Flash/Flex Developer at large
Blog: http://jrobinsonmedia.wordpress.com


John Robinson - Flash/Flex Developer at large
Blog: http://jrobinsonmedia.wordpress.com




[flexcoders] Re: binding not updating for ArrayCollection when item changes?

2009-03-10 Thread Tim Hoff

Hi John,

I seem to remember that XMLList, like Array, isn't Bindable and doesn't
dispatch a propertyChange event.  You might try changing the public var
to a getter/setter and manually dispatching the event, or change the
XMLList to Object; to see if it makes a difference.  This is just a shot
in the dark, but let us know if it helps.

-TH

--- In flexcoders@yahoogroups.com, John Robinson jrobi...@... wrote:

 Nice catch! That didn't seem to be causing the problem but thanks for
 pointing it out.

 I've simplified the case in that I'm not calling the web service
 anymore, just flipping the enabled property but binding still is not
 updating. Any other ideas?

 Thanks,
 John

 On Mar 10, 2009, at 10:53 AM, valdhor wrote:

  I don't know if this is your problem but one thing I noticed is youu
  have an ambiguous set of your enabled property. You have
 
  enabled = enabled;
 
  which (I assume) is to set the enabled property of your class to the
  enabled parameter that is passed in. This won't work. You should
have
 
  this.enabled = enabled;
 
  or change one of the parameter names.
 
  --- In flexcoders@yahoogroups.com, John Robinson jrobinso@ wrote:
 
  I have a strange issue with data binding not updating when an item
in
  an ArrayCollection is changed. I'm using Cairngorm and have the
  following setup. In my ModelLocator I have a 'users'
ArrayCollection
  that contains 'UserVO' objects. I have a two views that binds their
  dataProvider to the 'users' AC in the ModelLocator. My UserVO looks
  like so:
 
  package com.jrobinson.model.VO
  {
  [Bindable]
  public class UserVO
  {
  public var id:int = -1;
  public var username:String = null;
  public var enabled:Boolean = false;
  public var userData:XMLList = null;
 
 
  public function UserVO(user_id:int, uName:String, enabled:Boolean,
  d:XMLList)
  {
  id = user_id;
  username = uName;
  enabled = enabled;
  userData = d;
  }
 
  }
  }
 
  I first have a command that loads all of the users and populates
the
  AC. This updates the bindings as expected. I then have a second
  command that loads the userData portion for a given user. Once
  retrieved, I update the given UserVO's userData, but this time, the
  bindings fail to update.
 
  I feel like I've seen this before but can't find where or what the
  workaround might be. I guess I'm just looking for confirmation that
  this should or shouldn't work.
 
  Thanks!
  John
 
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location:
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\
1e62079f6847
  Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
  ! Groups Links
 
 
 



 John Robinson - Flash/Flex Developer at large
 Blog: http://jrobinsonmedia.wordpress.com


 John Robinson - Flash/Flex Developer at large
 Blog: http://jrobinsonmedia.wordpress.com






RE: [flexcoders] Re: binding not updating for ArrayCollection when item changes?

2009-03-10 Thread Tracy Spratt
Doh, I missed that.  That is definitely the case, XMLList is not bindable.
XML is, and also XMLListColelction is as well.  Object is not.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Tim Hoff
Sent: Tuesday, March 10, 2009 4:28 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: binding not updating for ArrayCollection when item
changes?

 


Hi John,

I seem to remember that XMLList, like Array, isn't Bindable and doesn't
dispatch a propertyChange event. You might try changing the public var
to a getter/setter and manually dispatching the event, or change the
XMLList to Object; to see if it makes a difference. This is just a shot
in the dark, but let us know if it helps.

-TH

--- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com,
John Robinson jrobi...@... wrote:

 Nice catch! That didn't seem to be causing the problem but thanks for
 pointing it out.

 I've simplified the case in that I'm not calling the web service
 anymore, just flipping the enabled property but binding still is not
 updating. Any other ideas?

 Thanks,
 John

 On Mar 10, 2009, at 10:53 AM, valdhor wrote:

  I don't know if this is your problem but one thing I noticed is youu
  have an ambiguous set of your enabled property. You have
 
  enabled = enabled;
 
  which (I assume) is to set the enabled property of your class to the
  enabled parameter that is passed in. This won't work. You should
have
 
  this.enabled = enabled;
 
  or change one of the parameter names.
 
  --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com, John Robinson jrobinso@ wrote:
 
  I have a strange issue with data binding not updating when an item
in
  an ArrayCollection is changed. I'm using Cairngorm and have the
  following setup. In my ModelLocator I have a 'users'
ArrayCollection
  that contains 'UserVO' objects. I have a two views that binds their
  dataProvider to the 'users' AC in the ModelLocator. My UserVO looks
  like so:
 
  package com.jrobinson.model.VO
  {
  [Bindable]
  public class UserVO
  {
  public var id:int = -1;
  public var username:String = null;
  public var enabled:Boolean = false;
  public var userData:XMLList = null;
 
 
  public function UserVO(user_id:int, uName:String, enabled:Boolean,
  d:XMLList)
  {
  id = user_id;
  username = uName;
  enabled = enabled;
  userData = d;
  }
 
  }
  }
 
  I first have a command that loads all of the users and populates
the
  AC. This updates the bindings as expected. I then have a second
  command that loads the userData portion for a given user. Once
  retrieved, I update the given UserVO's userData, but this time, the
  bindings fail to update.
 
  I feel like I've seen this before but can't find where or what the
  workaround might be. I guess I'm just looking for confirmation that
  this should or shouldn't work.
 
  Thanks!
  John
 
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ:
http://groups.
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location:
https://share.
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e6
2079f6847 acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\
1e62079f6847
  Search Archives:
http://www.mail-
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
archive.com/flexcoders%40yahoogroups.comYahoo
  ! Groups Links
 
 
 



 John Robinson - Flash/Flex Developer at large
 Blog: http://jrobinsonmed http://jrobinsonmedia.wordpress.com
ia.wordpress.com


 John Robinson - Flash/Flex Developer at large
 Blog: http://jrobinsonmed http://jrobinsonmedia.wordpress.com
ia.wordpress.com






[flexcoders] Re: binding not updating for ArrayCollection when item changes?

2009-03-10 Thread Tim Hoff

Ha, doh back for Object. :)

-TH

--- In flexcoders@yahoogroups.com, Tracy Spratt tspr...@... wrote:

 Doh, I missed that. That is definitely the case, XMLList is not
bindable.
 XML is, and also XMLListColelction is as well. Object is not.



 Tracy Spratt,

 Lariat Services, development services available

 _

 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
On
 Behalf Of Tim Hoff
 Sent: Tuesday, March 10, 2009 4:28 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: binding not updating for ArrayCollection
when item
 changes?




 Hi John,

 I seem to remember that XMLList, like Array, isn't Bindable and
doesn't
 dispatch a propertyChange event. You might try changing the public var
 to a getter/setter and manually dispatching the event, or change the
 XMLList to Object; to see if it makes a difference. This is just a
shot
 in the dark, but let us know if it helps.

 -TH

 --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com,
 John Robinson jrobinso@ wrote:
 
  Nice catch! That didn't seem to be causing the problem but thanks
for
  pointing it out.
 
  I've simplified the case in that I'm not calling the web service
  anymore, just flipping the enabled property but binding still is not
  updating. Any other ideas?
 
  Thanks,
  John
 
  On Mar 10, 2009, at 10:53 AM, valdhor wrote:
 
   I don't know if this is your problem but one thing I noticed is
youu
   have an ambiguous set of your enabled property. You have
  
   enabled = enabled;
  
   which (I assume) is to set the enabled property of your class to
the
   enabled parameter that is passed in. This won't work. You should
 have
  
   this.enabled = enabled;
  
   or change one of the parameter names.
  
   --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com, John Robinson jrobinso@ wrote:
  
   I have a strange issue with data binding not updating when an
item
 in
   an ArrayCollection is changed. I'm using Cairngorm and have the
   following setup. In my ModelLocator I have a 'users'
 ArrayCollection
   that contains 'UserVO' objects. I have a two views that binds
their
   dataProvider to the 'users' AC in the ModelLocator. My UserVO
looks
   like so:
  
   package com.jrobinson.model.VO
   {
   [Bindable]
   public class UserVO
   {
   public var id:int = -1;
   public var username:String = null;
   public var enabled:Boolean = false;
   public var userData:XMLList = null;
  
  
   public function UserVO(user_id:int, uName:String,
enabled:Boolean,
   d:XMLList)
   {
   id = user_id;
   username = uName;
   enabled = enabled;
   userData = d;
   }
  
   }
   }
  
   I first have a command that loads all of the users and populates
 the
   AC. This updates the bindings as expected. I then have a second
   command that loads the userData portion for a given user. Once
   retrieved, I update the given UserVO's userData, but this time,
the
   bindings fail to update.
  
   I feel like I've seen this before but can't find where or what
the
   workaround might be. I guess I'm just looking for confirmation
that
   this should or shouldn't work.
  
   Thanks!
   John
  
  
  
  
  
   
  
   --
   Flexcoders Mailing List
   FAQ:
 http://groups.
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Alternative FAQ location:
 https://share.

https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf\
-1e6
 2079f6847 acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\
 1e62079f6847
   Search Archives:
 http://www.mail-
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
 archive.com/flexcoders%40yahoogroups.comYahoo
   ! Groups Links
  
  
  
 
 
 
  John Robinson - Flash/Flex Developer at large
  Blog: http://jrobinsonmed http://jrobinsonmedia.wordpress.com
 ia.wordpress.com
 
 
  John Robinson - Flash/Flex Developer at large
  Blog: http://jrobinsonmed http://jrobinsonmedia.wordpress.com
 ia.wordpress.com
 






[flexcoders] Re: binding not updating for ArrayCollection when item changes?

2009-03-10 Thread valdhor
How do you update a given UserVO's userData? Do you directly access the
public properties?

I have never done it this way - I use getters and setters...

package com.jrobinson.model.VO
{
 [Bindable]
 public class UserVO
 {
 private var _id:int = -1;
 private var _username:String = null;
 private var _enabled:Boolean = false;
 private var _userData:XMLList = null;

 public function UserVO(id:int, username:String, enabled:Boolean,
userData:XMLList)
 {
 _id = id;
 _username = username;
 _enabled = enabled;
 _userData = userData;
 }

 //accessor methods
 public function get id():int {return _id;}
 public function get username():String {return _username;}
 public function get enabled():Boolean {return _enabled;}
 public function get userData():XMLList {return _userData;}

 //mutator methods
 public function set id(id:int):void {_id = id;}
 public function set username(username:String):void {_username =
username;}
 public function set enabled(enabled:Boolean):void {_enabled =
enabled;}
 public function set userData(userData:XMLList):void {_userData =
userData;}
 }
}



--- In flexcoders@yahoogroups.com, John Robinson jrobi...@... wrote:

 Nice catch! That didn't seem to be causing the problem but thanks for
 pointing it out.

 I've simplified the case in that I'm not calling the web service
 anymore, just flipping the enabled property but binding still is not
 updating. Any other ideas?

 Thanks,
 John

 On Mar 10, 2009, at 10:53 AM, valdhor wrote:

  I don't know if this is your problem but one thing I noticed is youu
  have an ambiguous set of your enabled property. You have
 
  enabled = enabled;
 
  which (I assume) is to set the enabled property of your class to the
  enabled parameter that is passed in. This won't work. You should
have
 
  this.enabled = enabled;
 
  or change one of the parameter names.
 
  --- In flexcoders@yahoogroups.com, John Robinson jrobinso@ wrote:
 
  I have a strange issue with data binding not updating when an item
in
  an ArrayCollection is changed. I'm using Cairngorm and have the
  following setup. In my ModelLocator I have a 'users'
ArrayCollection
  that contains 'UserVO' objects. I have a two views that binds their
  dataProvider to the 'users' AC in the ModelLocator. My UserVO looks
  like so:
 
  package com.jrobinson.model.VO
  {
   [Bindable]
   public class UserVO
   {
public var id:int = -1;
public var username:String = null;
public var enabled:Boolean = false;
public var userData:XMLList = null;
 
 
public function UserVO(user_id:int, uName:String,
enabled:Boolean,
  d:XMLList)
{
 id = user_id;
 username = uName;
 enabled = enabled;
 userData = d;
}
 
   }
  }
 
  I first have a command that loads all of the users and populates
the
  AC. This updates the bindings as expected. I then have a second
  command that loads the userData portion for a given user. Once
  retrieved, I update the given UserVO's userData, but this time, the
  bindings fail to update.
 
  I feel like I've seen this before but can't find where or what the
  workaround might be. I guess I'm just looking for confirmation that
  this should or shouldn't work.
 
  Thanks!
  John
 
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location:
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\
1e62079f6847
  Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
  ! Groups Links
 
 
 



 John Robinson - Flash/Flex Developer at large
 Blog: http://jrobinsonmedia.wordpress.com


 John Robinson - Flash/Flex Developer at large
 Blog: http://jrobinsonmedia.wordpress.com