开发者

Can you bind an ArrayCollection with custom class objects to a Tree?

I made a class Person.as with a few variables. Then I made an Arr开发者_开发百科ayCollection and did addItem(person1); addItem(person2); and binded this arraycollection to my tree with dataProvider="{oadp_tree}". Now it doesn't show up in my Tree.. While I made an example with dummy data in MXML and it does show up in my tree (MXML example uses .

Do I need to build my ArrayCollection up with var something:Object or can I use classes?


You can absolutely use an ArrayCollection with custom objects in it.

  1. Put all your elements in the ArrayCollection
  2. Bind the dataProvider property to the ArrayCollection
  3. Implement a labelFunction for the tree. This is enough for almost 80% of all cases I would say...

You can find some exmaple here:

  • http://blog.flexexamples.com/2007/10/29/defining-a-custom-label-function-on-a-flex-tree-control/

If this should help, please vote/mark the answer. THX


Take a look at Tree's dataDescriptor:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/Tree.html#dataDescriptor

And also labelField & labelFunction in the same object.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜