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

Selecting an unselected row dispatches two selection events #32

Open
RhonanMS opened this issue Sep 10, 2018 · 0 comments
Open

Selecting an unselected row dispatches two selection events #32

RhonanMS opened this issue Sep 10, 2018 · 0 comments

Comments

@RhonanMS
Copy link

I am using a SelectGrid with a TableSelectionModel using the selection mode TableSelectionMode.SHIFT.

When selecting a previously unselected row without holding the Ctrl key, the underlying CtrlClickSelectionHandler calls SelectionModel<JsonObject>.deselectAll(). This triggers an event with an empty selection, almost immediately following by an event with the newly selected row.

Example:

SelectGrid<T> grid2 = new SelectGrid<>();
TableSelectionModel<T> tableSelectionModel = new TableSelectionModel<>();
tableSelectionModel.setMode(TableSelectionMode.SHIFT);
grid2.setSelectionModel(tableSelectionModel);
grid2.addSelectionListener(event -> {
	LOGGER.debug(String.format("%d entries in selection", 
		event.getAllSelectedItems().size()));
});

When selecting a row as described above, the logger returns the following:

[DEBUG] 0 entries in selection 
[DEBUG] 1 entries in selection 

I would have expected only one event containing the new selection instead of two, one of which contains an empty selection. Is it possible to allow for this behaviour?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant