Vaadin 14 Grid - How to iterate over all buttons in grid rows

I'm developing an app in Vaadin 14.5.3. I have a Grid in which each row contains, amongst other things, a TextField and two Buttons.

My requirement is that when the TextField value in any row is changed, all of the buttons in all of the rows need to be disabled.

Is there a way to iterate over the rows in such a way as to allow me to interact with each button?


If you need to update Grid's rows, the way to do it is to call

grid.getDataProvider().refreshAll();

It will make Grid iterate items in the view and regenerate their data / components.

So in your case you would have some thing like

boolean done = false; // class field
...
grid.addComponentColumn(item -> {
   TextFiled field = new TextField();
   field.setValue(item.getProperty()); // Populate field
   field.addValueChangeListener(event -> {
       item.setProperty(event.getValue());
       done = true;
       grid.getDataProvider().refreshAll();
   });
});
grid.addComponentColumn(item -> {
    Button button = new Button("Button");
    button.setEnabled(!done);
    return button;
});

Vaadin 14.5.3.

Side note, 14.5.3 is old. At time of writing this 14.8.2 is the newest. You should update your framework version regularly in order to keep upto date with security fixes and bug fixes.