Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Add a row to a grid when a row edit is committed
In order that editing a grid might resemble editing a table in SQL Server Studio, I would like to add a 'blank' row to the bottom of a grid. When this row is edited and saved with actual values, a new 'blank' row would be added on. Adding an item to the Grid inside the CommitListener always fails. Am I asking the impossible? Is there a suggested strategy for dynamically modifying the Grid based on edit actions?
you should be able add a new item to the Grid's container in a CommitHandler. If you're using something like a BeanItemContainer, make sure that you're actually adding a new object and not just re-adding the same object you just edited.
When I do something like this:
IndexedContainer source = (IndexedContainer) grid.getContainerDataSource();
inside the postCommit(), the propertyDataSource comes up null in FieldGroup.commitTransactions().
Am I doing it wrong?
It depends on the details of the rest of your code. Not all datasources support addItem, for example, although I suppose that's not your problem if you're getting a null from getContainerDataSource. I don't know if there's any reason why getContainerDataSource shouldn't work inside the commit listener, but maybe try accessing the datasource with some other means like by adding it as a member variable with a getter.