flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mihai Chira <mihai.ch...@gmail.com>
Subject Re: Odd behavior in ArrayCollection
Date Mon, 08 Jun 2015 08:42:53 GMT
Could you turn the properties into getter / setter pairs, and place a
breakpoint on the setter, to see who is changing the value to null? Or
you could try "trace(new Error().getStackTrace())" in the setter,
which will tell you the same in the console.

On 7 June 2015 at 21:49, DavidM <dmoshal@gmail.com> 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.

Mime
View raw message