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

Missing ItemPropertyChangedEvent in GridPro #6981

Open
tomivirkki opened this issue Dec 20, 2024 · 0 comments
Open

Missing ItemPropertyChangedEvent in GridPro #6981

tomivirkki opened this issue Dec 20, 2024 · 0 comments

Comments

@tomivirkki
Copy link
Member

tomivirkki commented Dec 20, 2024

Description

In certain rare cases, an ItemPropertyChangedEvent may not get dispatched at all (due to this check in the web component):

Kapture.2024-12-20.at.15.42.53.mp4

Related #6978

Expected outcome

The ItemPropertyChangedEvent should dispatch on editor change

Minimal reproducible example

@Route("vaadin-grid-pro/test")
public class GridProTestPage extends Div {
    public GridProTestPage() {
        GridPro<Bug> grid = new GridPro<>();

        List<Bug> bugs = List.of(new Bug("Bug 1", Severity.HIGH),
                new Bug("Bug 2", Severity.MEDIUM),
                new Bug("Bug 3", Severity.LOW));

        grid.setItems(bugs);

        Div log = new Div();

        grid.addColumn(Bug::getName).setHeader("Name");

        ComboBox<Severity> cb = new ComboBox<>();
        cb.setItems(Severity.values());
        cb.setItemLabelGenerator(severity -> severity.name());

        grid.addEditColumn(Bug::getSeverity).custom(cb, (item, newValue) -> {
            item.setSeverity(newValue);
            log.setText("Severity changed: " + newValue);
        }).setHeader("Severity");

        add(grid, log);
    }

    public static class Bug {
        private String name;
        private Severity severity;

        public Bug(String name, Severity severity) {
            this.name = name;
            this.severity = severity;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getName() {
            return name;
        }

        public void setSeverity(Severity severity) {
            this.severity = severity;
        }

        public Severity getSeverity() {
            return severity;
        }
    }

    public enum Severity {
        HIGH("3"), MEDIUM("2"), LOW("1");

        private String stringRepresentation;

        private Severity(String stringRepresentation) {
            this.stringRepresentation = stringRepresentation;
        }

        public String getStringRepresentation() {
            return stringRepresentation;
        }

        @Override
        public String toString() {
            return getStringRepresentation();
        }
    }
}

Steps to reproduce

  • Open the view
  • Try changing the severity from medium to high

Environment

Vaadin version(s): 24

Browsers

Issue is not browser related

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

No branches or pull requests

1 participant