Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when clearing selected items programatically #16

Closed
mlopezFC opened this issue Jul 27, 2020 · 1 comment
Closed

Problem when clearing selected items programatically #16

mlopezFC opened this issue Jul 27, 2020 · 1 comment
Assignees
Labels
Milestone

Comments

@mlopezFC
Copy link
Member

According to a comment in the discussions in the addon's Vaadin directory page:

Is there a way to clear the selected items programmatically. I tried with twinColGrid.setValue(null) which throws exception. Tried with twinColGrid.clear() which doesn't throw any exception, but doesn't clear the elements. I've also tried with twinColGrid.setValue(new HashSet<>()) which again, throws no exception, but doesn't clear

@javier-godoy javier-godoy added this to Inbox (needs triage) in Flowing Code Addons (legacy) via automation Jul 27, 2020
@javier-godoy javier-godoy self-assigned this Aug 5, 2020
@javier-godoy
Copy link
Member

The "value" of a TwinColGrid is the set of right-selected items, thus setValue isn't expected to modify the lists in any way. In order to clear the lists one has to call setItems(Collections.emptyList()))

setValue(null) indeeds throws an exception., which seems to be the correct behavior since getItems() returns an empty set when no items are selected.

On the other hand clear() DOES throw an exception (as of 2.0.4-SNAPSHOT) because it's implemented as setValue(getEmptyValue()) and getEmptyValue() returns null.

Flowing Code Addons (legacy) automation moved this from Inbox (needs triage) to Done Aug 5, 2020
@javier-godoy javier-godoy added this to the 2.1.0 milestone Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

2 participants