Let’s say I’ve a button and a table.
The user selects a row by clicking in the table and the row is highlighted as the current row.
Then the user clicks the button. In the ClickListener of the button, I’d like to deselect the current row, so the table appears as if the user had not clicked the table yet.
I tried table.setValue(null) in the button’s ClickListener but with no success.
here is my implementation of ItemClickListener.itemClick:
public void itemClick(ItemClickEvent event) {
boolean modifier = event.isCtrlKey() || event.isShiftKey();
if (!modifier){
((Table)event.getSource()).setValue(null);
((Table)event.getSource()).select(event.getItemId());
}
}
i.e. if the user does not press SHIFT or CTRL when clicking on a row, I want to deselect all.
I tried both suggestions (table.select(null) or table.setValue(null)), but the table rows remain selected.
In debug mode, I see that setValue is properly executed, but the selection is restored after that by a call from CommunicationManager.handleVariables.