Grid and editing

Hello,

iam struggeling since 7 hours with vaadin grid.

iam Using Vadin 16.0.2

i followed this tutorial here:
https://vaadin.com/components/vaadin-grid/java-examples/grid-editor

but it doesnt work like in the tutorial.

I think the listed code is not the actual code.

for example

Grid.Column<Person> editorColumn = grid.addComponentColumn(person -> {
    Button edit = new Button("Edit");
    edit.addClassName("edit");
    edit.addClickListener(e -> {
        editor.editItem(person);
        firstNameField.focus();
    });
    edit.setEnabled(!editor.isOpen());
    editButtons.add(edit);
    return edit;
});

everytime when an event occurs it adds an edit button. That cant be correct.

anyway.
if i click on edit and edit both fields and click on save. After clicking on the next edit button the first row disapears.

please check the attachments 1-3.jpgs

whats wrong with this grid?
why it is so hard to edit grid elements?

please help with a good example for vaadin 16.
regards

18396939.jpg
18396942.jpg
18396945.jpg

Which of the examples is not working. I copy-pasted the first one on the page you linked with 16.0.2 and it seems to work when I have a trivial two item in-memory data i.e. an ArrayList of two Person objects.

Ender Ayalp:
Hello,

iam struggeling since 7 hours with vaadin grid.

iam Using Vadin 16.0.2

i followed this tutorial here:
https://vaadin.com/components/vaadin-grid/java-examples/grid-editor

but it doesnt work like in the tutorial.

I think the listed code is not the actual code.

for example

Grid.Column<Person> editorColumn = grid.addComponentColumn(person -> {
    Button edit = new Button("Edit");
    edit.addClassName("edit");
    edit.addClickListener(e -> {
        editor.editItem(person);
        firstNameField.focus();
    });
    edit.setEnabled(!editor.isOpen());
    editButtons.add(edit);
    return edit;
});

everytime when an event occurs it adds an edit button. That cant be correct.

anyway.
if i click on edit and edit both fields and click on save. After clicking on the next edit button the first row disapears.

please check the attachments 1-3.jpgs

whats wrong with this grid?
why it is so hard to edit grid elements?

please help with a good example for vaadin 16.
regards

if you can help me with my case, I am grateful

https://vaadin.com/forum/thread/18525966/edit-off-grid-button

Johannes Häyry:
Which of the examples is not working. I copy-pasted the first one on the page you linked with 16.0.2 and it seems to work when I have a trivial two item in-memory data i.e. an ArrayList of two Person objects.

if you can help me with my case, I am grateful

https://vaadin.com/forum/thread/18525966/edit-off-grid-button