Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Problem with tree
Hi and happy new year,
new year new questions. Can anybody tell me how to set on a Tree a property.
On a TreeItem i can call a methode setItemProperty but i must give a interface Property or something. But i can implements the interface. I don´t know to use this function. But i need to give my item a hidden key. If the user select a item i will start a action. The Tree build with Objects and i need the object in the action after selection.
What can i do ?
And a another question:
On my tree the items with no children have also a triangle, where you can expand them but there are nothing to expand. How can i delete it ?
Thanks for your help,
the first problem is fixed...
Know only the triangle problem exists.
i can fix both problems ..
To provide answers to those that find this thread later on with similar issues.
The first issue can be fixed with either putting the key as itemId or adding a property to the item itself, so either tree.addItem(theKey); or if you need the itemId to be something else, tree.addContainerProperty("theKey") Item item = tree.addItem(object); item.getItemProperty("theKey").setValue(key);
The second issue is fixed by calling tree.setChildrenAllowed(Object itemId, boolean areChildrenAllowed) on those items that doesn't have children.