问题
My question is very simple but I really didn't find any solution here. I have a Table setSelectable(true), setMultiselect(false), setImmediate(true).
It works fine by first click and moving through the table using arrows. But if I click again to the row already having been selected, then it becomes unselected. How to prevent it? I'd like to have kept just one row always selected.
回答1:
As from the Vaadin Book here:
If the user clicks on an already selected item, the selection will deselected and the table property will have null value. You can disable this behaviour by setting setNullSelectionAllowed(false) for the table.
So:
table.setNullSelectionAllowed(false);
来源:https://stackoverflow.com/questions/22424834/how-to-select-just-one-row-prevent-to-unselect-item-in-singleselect-mode