How to select just one row, prevent to unselect item in singleselect mode

馋奶兔 提交于 2020-01-21 11:59:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!