Why are you refreshing arraycollection after this a['prop2'] = 'third' . Ideally if collection refresh should only used with sorting, filtering & with view cursor. remove arr.refresh() and make your class bindable and check again.
On Mon, Jun 8, 2015 at 11:35 AM, DavidM [via Apache Flex Users] < [email protected]> wrote: > Hi, I'm seeing odd behaviour when updating a single property of an item in > an > arraycollection. > > Given an ArrayCollection: > > [Bindable] > public var arr:ArrayCollection = new ArrayCollection() > > which contains objects like this: > > [Bindable] > public class ClassA{ > public var prop1:String; > public var prop2:String; > } > > Then: I put an object in the collection: > > var a:ClassA = new ClassA() > a.prop1 = 'first' > a.prop2 = 'second' > arr.addItem(a) > > Later, I find that object in the array (the Util.findObject is my code, > and > it does find the object, that's not the problem) > > var a:ClassA = Utils.findObject(arr, 'prop1', 'first') > a trace on a shows that prop1='first' and prop2 = 'second' > > Now, here's the problem, I update one of these properties, and the rest > are > all set to null !! > > a['prop2'] = 'third' > arr.refresh() > > Now a trace on object 'a' shows that prop1 is null, and the DataGrid shows > a > blank cell where object a's prop1 was! > > Does that make sense? > > David > > > > > > > > > -- > View this message in context: > http://apache-flex-users.2333346.n4.nabble.com/Odd-behavior-in-ArrayCollection-tp10526.html > Sent from the Apache Flex Users mailing list archive at Nabble.com. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://apache-flex-users.2333346.n4.nabble.com/Odd-behavior-in-ArrayCollection-tp10529.html > To unsubscribe from Apache Flex Users, click here > <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=cHJhc2hha3VtYXJAZ21haWwuY29tfDF8LTU0MTcyMzE2NA==> > . > NAML > <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- *Regards,* Prashant Kumar* | *Mob.: +91 8408811225 -- View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Odd-behavior-in-ArrayCollection-tp10529p10530.html Sent from the Apache Flex Users mailing list archive at Nabble.com.
