I am using the following ways to control a cell in a column based on the value of the row in a different column.
salaryReviewsTable.addGeneratedColumn("jobPositionOpmNote", entity -> {
TextField<String> textField = uiComponents.create(TextField.TYPE_STRING);
textField.setWidth("100%");
textField.setValue(entity.getJobPositionOpmNote());
textField.addValueChangeListener(e -> entity.setJobPositionOpmNote(e.getValue()));
if (entity.getApproved() == true) {
textField.setEditable(false);
}
return textField;
});
This is working just perfectly.
This is working for different data/ component types like VlookupField, textField etc. However, I was not successful in doing the same for a logical field (CheckBoxField). I tried the following without a success:
salaryReviewsTable.addGeneratedColumn("promoteOpm", entity -> {
TextField<CheckBox> textField = uiComponents.create(CheckBox.NAME);
textField.setWidth("100%");
textField.setValue(entity.getPromoteOpm().booleanValue());
textField.addValueChangeListener(e -> entity.setPromoteOpm(e.getValue().isChecked()));
if (entity.getApproved() == true) {
textField.setEditable(false);
}
return textField;
});
Any help will be appreciated.