开发者

ArrayCollection getItemAt

I created an Item Renderer for the Flex Spark List Component. The problem is that this code will not work:

    <s:Label left="10" right="10" top="10" bottom="10" fontSize="13" text="{data.getItemAt(1).toString()}"
         textAlign="left" verticalAlign="middle"/>

While this code will:

开发者_JAVA百科    <s:Label left="10" right="10" top="10" bottom="10" fontSize="13" text="{data[1].toString}"
         textAlign="left" verticalAlign="middle"/>

I can't use the later code because of binding issues. Does anyone have any idea on what I'm doing wrong?


As @J_A_X' comment stated, these are two completely different things.

{data.getItemAt(1)...

Refers to an ArrayCollection, or possibly some other collection.

{data[1]...

Refers to an Array.

Attempting to treat an array as an array collection will not get you very far. I would recommend ensuring that the each item in your list is actually an ArrayCollection. Alternatively, I would more strongly support replacing them with value objects, and binding to a 'title','text', or whatever property more correctly defines the text you wish to display.

{data.title}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜