Second tree selection unselects

When I click on a tree node, the tree shows the item with a blue background (as normal). When I click on that same element again, the blue background goes away and there is a dotted blue border. Clicking it a third time makes the element have a blue background again.

This ‘feature’ can be seen in the demo:

What do I need to add to the demo code to make a second selection act the same as a first and third selection – to make the background stay blue?


I think you would have to use setSelectable(false) to disable the normal selection by user input. Next, you should implement your own clickhandler, which always selects an item when an item is left-clicked (and deselects all other items, if you don’t want to select multiple items this way).