is it possible to say the new Tree that it should its items as HTML elements? Some of the elements in my tree are very long texts (for instnace descriptions), so I was looking for a method to display them in several lines. But it seems that Tree isn’t supporting something like that, so I used a customized ItemCaptionGenerator to wrap these texts into a -tag, but then the Tree is showing something like this text. Then I tried so set the contentmode to HTML but then the Page with the tree couldn’t be loaded.
So, is there a way to say the Tree that it should render the captions of its items as html, or any other method to display its items with multiple lines?
Hi Moritz,
thanks for the Tip with the HtmlRender. Now my Tree renders the captions of its items as Html-Elements, but now I’ve some problems with the sizing. I reset the sizing properties of the underlaying TreeGrid to its default, so that it is forced to adapt the sizes to the row’s content, but somehow it has no effect.
Vaadin 8 Tree has a ContentMode starting from 8.1.0.beta3. You can tell Tree to show your data as HTML, and you can provide a static row height for all your rows.
I’ve already tried to set the ContentMode to HTML, but when I did that the page became unloadable, say the page froze at 80% or 90% and ran into a timeout. It worked when I a took the underlaying TreeGrid set an HtmlRenderer for “column”.
Anyways, I came to the conclusion that I can not use the Tree for my purpose. The Vaadin 8 Tree is unfortunately not flexiable enough for my needs.
The Tree component is on purpose a simplified version of the TreeGrid. It is intended as the quick to set up for specific tasks alternative. If you have needs of a more complex hierarchical component, you should use TreeGrid directly. The Tree is using a custom theming for the TreeGrid by setting the primary style name to
v-tree8 . You can either keep the Grid-like theming of TreeGrid, or copy what you want from the theme of the Tree.