I have 4 different columns in a table that is editable. However, out of 4 columns, I want to make one column editable only when the specific criteria are met.
As you see in the following code, I want the column “vatAmount” should be editable when the criteria beliw is met. All other columns (3) should remain always editable. The code below is not working, thanks for any help.
DataGridEditor<SalesPriceLine> editor = salesPriceLineTable.getEditor();
salesPriceLineTable.addItemClickListener(e -> {
if(e.getColumn().equals("vatAmount")) {
if (getEditedEntity().getFixedVatPerUnit()) {
editor.editItem(e.getItem());
Component editorComponent = e.getColumn().getEditorComponent();
if (editorComponent instanceof Focusable) {
((Focusable) editorComponent).focus();
}
}
}else{
editor.editItem(e.getItem());
Component editorComponent = e.getColumn().getEditorComponent();
if (editorComponent instanceof Focusable) {
((Focusable) editorComponent).focus();
}
}
});