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

Unable programmatically deselect item in IE11 #2040

Closed
alexberazouski opened this issue May 31, 2018 · 1 comment
Closed

Unable programmatically deselect item in IE11 #2040

alexberazouski opened this issue May 31, 2018 · 1 comment
Labels

Comments

@alexberazouski
Copy link

After grid.deselectAll() was called, I expect any click on any item will select the item.

Assume the following code:

    @Id("grid")
    private Grid<String> grid;

        grid.setSelectionMode(Grid.SelectionMode.SINGLE);
        grid.addSelectionListener(e -> {
            e.getFirstSelectedItem().ifPresent(item -> System.out.println("Selected Item: " + item));
            grid.deselectAll();
        });

        grid.addColumn(s -> s);
        grid.setItems("1", "2", "3", "4", "5");

In IE11 I need an extra click on item for manually deselection (basically, item is deselected, but it is still so-called activeItem).

Then I tried to reset activeItem manually:

...
        grid.deselectAll();
        grid.getElement().setProperty("activeItem", null);

This hack fixes the issue only for the first two selections of the same item.

For some reason only the following workaround fixes the issue:

...
       grid.deselectAll();
       getElement().callFunction("resetActiveItem");

where resetActiveItem method does: this.$.grid.activeItem = null;

Code example:
vaadin/skeleton-starter-flow-spring@master...alexberazouski:grid-active-item

Run in production: mvn spring-boot:run -Dvaadin.productionMode

Bug is reproduced in IE11 only.

@vaadin-bot vaadin-bot transferred this issue from vaadin/vaadin-grid-flow Oct 6, 2020
@tomivirkki
Copy link
Member

Closing. Seems to work on V14.4

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

No branches or pull requests

3 participants