Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Grid details and editing rows
i have a grid component where I can edit rows and also I have implemented a details generator for each row. Everything works fine except the way how edit mode and details are displayed. The default way for editing rows in Grid is to double click on a row and you can edit the row and save or cancel your changes. For displaying the row details i added an item click listener and for a click on a row i make the details visible. The problem I have is when I want to edit a row I have to double click on a row, but somehow the double click is not interpreted as double click but rather interpreted as two separate single clicks. This leads to open the details for a second and to close the details on the second click. Afterwards I am able to edit my row.
The event.isDoubleClick() method returned by the item click listener seems somehow not to notice that there was a double click.
Has somebody experienced the same problem? Or does somebody has a solution for this problem? Or am I doing things completely wrong? If yes please let me know how to do it correctley
My understanding is that you are not supposed to use editor row and details generator at the same time for this obvious reason. So when using details generator, you should do setEditorEnable(false) first.
But disabling the editor has no effect on recognizing a double click or not. Because I want to rely on the default behavior of the editor, when double clicking the editor should be opened and if click only once I want to open the details.
By attempting to do it in they way you do you will cause race condition between two clicklisteners. There is clicklistener embedded in the edit row and you have written another one for opening details generator. Now it becomes sporadic which one seems to take the event. This is not a good design pattern.
In Vaadin 7.6. there is context menu functionality available. You could use that for opening details generator. Those events wont conflict.
You are absolutely right. it is sad, that this behavior is not implemented in a godd way.
The context menu is a possible solution, I was curious about the editor and details solution if that is possible. Sadly not.