You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Scott Matheson <sm...@intralinks.com> on 2014/08/08 20:24:10 UTC

Object question

Hi
     i have a array collection   of an object

Records:

field1:
field2:
Results[] holder 1,2,3,4 set of  each set of results can have 1-5 possible answers   So results is an array of Result objects

in an an item, render i want the [0] of result object


this.firstAtempt.results.getItemAt(0).date



does not seem to work ?





________________________________

Disclaimer: This electronic mail and any attachments are confidential and may be privileged. If you are not the intended recipient, please notify the sender immediately by replying to this email, and destroy all copies of this email and any attachments. Thank you.

Re: Object question

Posted by Alex Harui <ah...@adobe.com>.
Arrays are not bindable.  That's why Flex has an ArrayList and
ArrayCollection class.  Then the trick is to use ArrayList or
ArrayCollection within the data objects instead of Array.

On 8/8/14 1:33 PM, "Scott Matheson" <sm...@intralinks.com> wrote:

>Hi
>   if you think of a course made up of 10 lesson,
>
>lesson[]
>
>and the course has many lessons , and the student  can take the lesson
>test N times with each set of results held in an results object
>
>all works fine the challenge is getting the data back for display and
>making the data [Bindable]
>
>so i create an arrayCollection to hold the core data for display
>
>i pass the item render the specific lesson
>
><teacher:DictationLessonDetails displayPage="1"
>firstAtempt="{_u.dictationSyllabusArrayCol.getItemAt(1+lessonOffSet) as
>DictationLesson}" />
>
>this work fine, but in this object is all the results
>
>so this works in thee item render
>
><s:Label id="lesonTime" x="220" width="52" textAlign="center"
>text="{this.firstAtempt.time}"  verticalCenter="1"/>
>
>
>
>Now I need the specific of the last test of N tests
>
>text="{this.firstAtempt.results.getItemAt(0)
>
>would get me the result object, but.... how do i bind to the array of
>results
>
>text="{this.firstAtempt.results.getItemAt(0).result[0].score}"
>
>
>
>
>
>
>
>
>
>
>________________________________________
>From: Alex Harui [aharui@adobe.com]
>Sent: Friday, August 08, 2014 9:12 PM
>To: users@flex.apache.org
>Subject: Re: Object question
>
>An item renderer usually has a data property that references an object in
>the dataprovider/arraycollection.
>
>If the object has a field called results that is an array of other
>objects, it is important to determine if that is truly an array or an
>ArrayList or ArrayCollection.
>
>And if it is truly an array, then you have to use [0] instead of
>getItemAt(0), so I would expect renderer code to reference
>
>        this.data.results[0]
>
>HTH,
>-Alex
>
>
>On 8/8/14 11:24 AM, "Scott Matheson" <sm...@intralinks.com> wrote:
>
>>Hi
>>     i have a array collection   of an object
>>
>>Records:
>>
>>field1:
>>field2:
>>Results[] holder 1,2,3,4 set of  each set of results can have 1-5
>>possible answers   So results is an array of Result objects
>>
>>in an an item, render i want the [0] of result object
>>
>>
>>this.firstAtempt.results.getItemAt(0).date
>>
>>
>>
>>does not seem to work ?
>>
>>
>>
>>
>>
>>________________________________
>>
>>Disclaimer: This electronic mail and any attachments are confidential and
>>may be privileged. If you are not the intended recipient, please notify
>>the sender immediately by replying to this email, and destroy all copies
>>of this email and any attachments. Thank you.
>
>
>________________________________
>
>Disclaimer: This electronic mail and any attachments are confidential and
>may be privileged. If you are not the intended recipient, please notify
>the sender immediately by replying to this email, and destroy all copies
>of this email and any attachments. Thank you.


RE: Object question

Posted by Scott Matheson <sm...@intralinks.com>.
Hi
   if you think of a course made up of 10 lesson,

lesson[]

and the course has many lessons , and the student  can take the lesson test N times with each set of results held in an results object

all works fine the challenge is getting the data back for display and making the data [Bindable]

so i create an arrayCollection to hold the core data for display

i pass the item render the specific lesson

<teacher:DictationLessonDetails displayPage="1" firstAtempt="{_u.dictationSyllabusArrayCol.getItemAt(1+lessonOffSet) as DictationLesson}" />

this work fine, but in this object is all the results

so this works in thee item render

<s:Label id="lesonTime" x="220" width="52" textAlign="center" text="{this.firstAtempt.time}"  verticalCenter="1"/>



Now I need the specific of the last test of N tests

text="{this.firstAtempt.results.getItemAt(0)

would get me the result object, but.... how do i bind to the array of results

text="{this.firstAtempt.results.getItemAt(0).result[0].score}"










________________________________________
From: Alex Harui [aharui@adobe.com]
Sent: Friday, August 08, 2014 9:12 PM
To: users@flex.apache.org
Subject: Re: Object question

An item renderer usually has a data property that references an object in
the dataprovider/arraycollection.

If the object has a field called results that is an array of other
objects, it is important to determine if that is truly an array or an
ArrayList or ArrayCollection.

And if it is truly an array, then you have to use [0] instead of
getItemAt(0), so I would expect renderer code to reference

        this.data.results[0]

HTH,
-Alex


On 8/8/14 11:24 AM, "Scott Matheson" <sm...@intralinks.com> wrote:

>Hi
>     i have a array collection   of an object
>
>Records:
>
>field1:
>field2:
>Results[] holder 1,2,3,4 set of  each set of results can have 1-5
>possible answers   So results is an array of Result objects
>
>in an an item, render i want the [0] of result object
>
>
>this.firstAtempt.results.getItemAt(0).date
>
>
>
>does not seem to work ?
>
>
>
>
>
>________________________________
>
>Disclaimer: This electronic mail and any attachments are confidential and
>may be privileged. If you are not the intended recipient, please notify
>the sender immediately by replying to this email, and destroy all copies
>of this email and any attachments. Thank you.


________________________________

Disclaimer: This electronic mail and any attachments are confidential and may be privileged. If you are not the intended recipient, please notify the sender immediately by replying to this email, and destroy all copies of this email and any attachments. Thank you.

Re: Object question

Posted by Alex Harui <ah...@adobe.com>.
An item renderer usually has a data property that references an object in
the dataprovider/arraycollection.

If the object has a field called results that is an array of other
objects, it is important to determine if that is truly an array or an
ArrayList or ArrayCollection.

And if it is truly an array, then you have to use [0] instead of
getItemAt(0), so I would expect renderer code to reference

	this.data.results[0]

HTH,
-Alex


On 8/8/14 11:24 AM, "Scott Matheson" <sm...@intralinks.com> wrote:

>Hi
>     i have a array collection   of an object
>
>Records:
>
>field1:
>field2:
>Results[] holder 1,2,3,4 set of  each set of results can have 1-5
>possible answers   So results is an array of Result objects
>
>in an an item, render i want the [0] of result object
>
>
>this.firstAtempt.results.getItemAt(0).date
>
>
>
>does not seem to work ?
>
>
>
>
>
>________________________________
>
>Disclaimer: This electronic mail and any attachments are confidential and
>may be privileged. If you are not the intended recipient, please notify
>the sender immediately by replying to this email, and destroy all copies
>of this email and any attachments. Thank you.