<vaadin.version>7.4.3</vaadin.version>
In my GUI i display a Grid component.
The Datasource is a GeneratedPropertyContainer which is a wrapper over an BeanItemContainer.
The wrapper is needed to hide some
final BeanItemContainer<Object> container = new BeanItemContainer<Object>(entityClass, queryForTableNames.getResultList());
// Hide now internal columns
final GeneratedPropertyContainer wrapperContainer = new GeneratedPropertyContainer(container);
wrapperContainer.removeContainerProperty("internalId");
wrapperContainer.removeContainerProperty("lockedBy");
final Grid grid = new Grid(wrapperContainer);
grid.setImmediate(true);
grid.setEditorEnabled(true);
grid.setWidth("100%");
grid.setHeightByRows(22);
grid.setHeightMode(HeightMode.ROW);
The Problem is when an Item in the Grid is edited and saved with the Inline Editor, the GUI is not refreshed.
I checked in the postCommit of the FieldGroup.CommitHandler if the container is updated.
This is not true. But the Grid on the GUI does not show the change.
I had the same problem, and I think I ended up fixing it just now by implementing equals() for the entities being edited by the grid, i.e. you should compare the persistent ID’s, not the pointers. (To be fully honest, I also fiddled with setBuffered(true), and I don’t really know if that changed anything in the end.)
public void refresh() {
yourContainer.refresh();
System.out.println("Time data refreshed");
}
I admit that this is a bit “brute-force approach” as it refreshes the entire container from the DB, but until this strange behaviour is fixed, this workaround worked to me.
And I cannot unterstand, that I find the same problem still in Vaadin 8.1.7. How can it be, that the examples from Web and documentation do not work. Some time I loved Vaadin, but so elementary problem frustrate.