Chris Ghenea
Chris Ghenea

Reputation: 12943

Display multiple attributes in mx:Tree

Is it possible to display multiple attributes in a mx:Tree component? The XML looks like this:

<item comment="blabla" author="user1" date="21.05.2011">
    <item comment="blabla" author="user2" date="21.05.2011"/>
    <item comment="blabla" author="user3" date="21.05.2011"/>
</item>

I want each node to display the comment, author and date, on separate lines.

I am planning to use this to display something like the facebook wall: someone writes a message and the other users can comment.

Any ideas?

Upvotes: 0

Views: 159

Answers (2)

Jacob Eggers
Jacob Eggers

Reputation: 9322

If you were ok with all of the attributes on the same line, you could also use the labelFunction:

myLabelFunction(item:XML):String {
   return item.@comment + ' ' + item.@author + ' (' + item.@date + ')';
}

For another example, see: http://blog.flexexamples.com/2007/10/29/defining-a-custom-label-function-on-a-flex-tree-control/

Upvotes: 1

Dennis Jaamann
Dennis Jaamann

Reputation: 3565

You can use a custom ItemRenderer for this.

Checkout the Adobe livedocs: http://livedocs.adobe.com/flex/3/html/help.html?content=cellrenderer_8.html

Cheers

Upvotes: 4

Related Questions