The selection doesn’t work because the <vaadin-grid-tree-toggle> element calls preventDefault() on click events. This element wraps the toggle-button and other content in the cell. It’s still possible to select the row by clicking on other cells, or at the edges of the cell with the toggle-button.
A bit dangerous workaround for this would be to override the client-side click handler without using preventDefault():
@Pekka Maanpää:
Frankly - I consider the fact that one needs to divert to such hacks a severe usability bug of TreeGrid! And I am apparently not alone!
But nevertheless: I am currently hacking up a private tool where I would like to use Vaadin and I would be willing to apply such a hack (in favor of having to “re-invent” something like TreeGrid which I would consider a total overkill - in that case I would rather abandon Vaadin alltogether).
So - where and how would one need to apply the above hack? On which object would one have to call this addAttachListener(…)?
But for the reference, I wrote that ugly workaround a long time ago so can’t remember exactly my point with the attach listener, but I guess it is there just to make sure that an UI is available. It could be called for the view that has the TreeGrid, or even for the TreeGrid itself. The JavaScript needs to run only once, but it doesn’t matter if it runs multiple times.