Hi guys,
I am creating a grid with textfields where I want my data to be modifiable. It works when I call this code on a Textfield outside of the grid, but not there. I think I have to use a binder but I am struggling to understand how it should work here…
Can anyone help?
here is my code:
for (Week w : weekRepository.findAll()) {
Grid.Column<EmployeeProject> gridColumn = grid.addComponentColumn(employeeProject -> {
TextField amountTime = new TextField();
amountTime.setWidth("85px");
amountTime.setValue(String.valueOf(employeeProject.getAmountTimeEmployeeOnProject(w)));
//Code never called
amountTime.addKeyPressListener(Key.ENTER, keyPressEvent -> {
notificationMessage.openSuccess("Saving");
employeeProject.setAmountTimeEmployeeOnProject(employeeProject.getProject(), w, Integer.parseInt(amountTime.getValue()));
employeeProjectRepository.save(employeeProject);
});
return amountTime;
});
gridColumn.setHeader(w.getWeekNumber() + " / " + w.getYear());
}