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

Calling grid.getEditor().cancel() in EditorOpenEvent will render Grid in inconsistent state #11002

Closed
TatuLund opened this issue Jun 27, 2018 · 2 comments
Labels
bug workaround Workaround provided in ticket comments
Milestone

Comments

@TatuLund
Copy link
Contributor

Use the following method to conditionally disable some rows to be edited in Grid

    grid.getEditor().addOpenListener(new EditorOpenListener<SomeObject>() {

        @Override
        public void onEditorOpen(EditorOpenEvent<SomeObject> event) {
            if (!event.getBean().isEditable()) {
                grid.getEditor().cancel();
            }
        }

    });
  • Vaadin Framework version (8.4.4)
  • Expected behavior:

Grid opens when isEditable() returns true and is not opened when it returns false.

  • Actual behavior:

There is no client side exception but I can see the following on the console log

Editor bind action is taking longer than expected (5000ms). Does your EditorHandler remember to call success() or fail()?
Also, I observed, that Grid is not responding to any click actions. For example Rendered button does not work anymore, Clicking header to change sort direction has stopped working and it is not possible to open column selection menu (in case you have hidable columns)

@TatuLund
Copy link
Contributor Author

Can this be related to #10688 ?

@TatuLund
Copy link
Contributor Author

TatuLund commented Jun 28, 2018

Possible workaround 1:

One way you could workaround this issue, would be alternative method of disabling the editor opening. Since in normal cases it opens with mouse click, you could disable pointer events. This can be done by setting stylegenerator for row as follows:

grid.setStyleGenerator(item -> {
    if (item.isEditable()) return "row-edit-disabled";  
    else return "";
});

And then add the following css rule to your theme.scss mixin

.row-edit-disabled > td {
    pointer-events: none;
}

Possible workaround 2:

Use GridFastNavigation add-on, see discussion: TatuLund/GridFastNavigation#27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug workaround Workaround provided in ticket comments
Projects
None yet
Development

No branches or pull requests

2 participants