Clearing a multi-select table selection

I have a table that allows multiple selections. When I select an item or several items (using the shift or control key) it works. But I can’t seem to clear
all the selections. I tried myTable.select(null) which works on my single select tables, but on this one nothing seems to happen. I hope I’m missing something simple in the API - how do I clear all the selections in a multi-select table?

thanks,

nbc

Use myTable.setValue(null). That should do it.

Dana

I will try that - thanks very much!

nbc

Hi, i hav got the same problem here.

table.select(null);
table.setValue(null);
table.setValue(Collections.emptySet());

It visually unselect rows but next time i do table.getValue() the old selected items are back. :frowning:

Thanks

That definitely should not happen - most likely something is wrong elsewhere in the application.

In multi-select mode, Table.select(Object) just adds something to the selection, but setValue(null) or setValue(Collections.emptySet()) should clear the selection completely.

Which Vaadin version are you using?
Can you reproduce this with a minimal test program?
Also, make sure that null selection is allowed (setNullSelectionAllowed(true)) although it should be the default.

This problem is still here in version 7.7.3

I’m using drag&drop from a table to another table, checking selection to drag multiple row (very dummy mode), but I get same selection untill I manually click a new table row.

I’ve tried

table.select(null)
with
table.setNullSelectionAllowed(true);

Instead using
table.setValue(null)

work correctly.