Select items in a tree

Hi,

I want to use a tree component to display the categories of an entity. The categories are hierarchical and it is no problem to display them in the component.
The selected categories are stored in a collection in the entity after reading the entity from database.
My problem is to select the categories from the collection in the tree to show the actual selection.
The tree is in multi select mode.

Any ideas?

Karsten

Do you mean programmatically selecting them? Tree.setValue() - in multiselect mode takes a collection of item ids. Have you tried it?

Yes I tried it an nothing happens. It also dosen’t work if I try to select one item programmatically.

Are you sure that you’re giving
item IDs
not not the items themselves to setValue? Could you show some code how you create the container/fill the Tree?

Ouch - I changed the data model a while ago before I tested the Selection in the tree and so I gave the Items and not the IDs. Now it works

Sometimes it is too easy…

Many thanks
Karsten