Hi,
I’ve setup a very simple GridPro
to allow editing of User
objects, i.e.
GridPro<User> grid = new GridPro<>(PAGE_SIZE);
// .. Name
grid.addEditColumn(User::getName)
.text((ItemUpdater<User, String>) User::setName)
.setKey("name").setHeader(NAME).setFlexGrow(1).setSortable(true);
// .. Email
grid.addEditColumn(User::getEmail)
.text((ItemUpdater<User, String>) UsersMappingService.UserMapping::setEmail)
.setKey("email").setHeader(EMAIL).setFlexGrow(1).setSortable(true);
...
and then enabled the enterNextRow behaviour with:
grid.setEnterNextRow(true);
This allows the user to quickly move from one row/cell to the next which is very nice. However there’s no obivious way to trigger in the case of the last row in order to add a new row (kinda-like spreadsheet behaviour) would would be much nicer than the usual method of having a discrete “+”/“Add” button.
I’ve looked at the Java source and there’s no easy way to get this bevhaviour (there’s no @DomEvent listener for the enter-next-row, checking the grid.getEditor().isOpen() returns false always in a “keyup” event listener, there’s no CellEditFinishedEvent
to match CellEditStartedEvent
to track the state myself etc.)
Related to this I have an additional issue in that if I use the following to add a new empty row the editor is not started properly … i.e. the focus is not moved to the 1st field in the new row:
User newRow = new User();
listDataProvider.getItems().add(newRow);
listDataProvider.refreshAll();
grid.select(newRow);
grid.getEditor().editItem(newRow);
Any ideas?