Changing table-cell editable state of a boolean column based on a condition at runtime

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.

Hello,

what type of field do you want to create in the promoteOpm column? To work with the Boolean type it is better to use CheckBox instead of TextField<CheckBox>.