As we know in order to get smooth cursor navigation across editable cells in a table we have to use the following codes (workaround until the issue is fixed). This is working fine.
@Subscribe
public void onInit(InitEvent event) {
//for smooth keyboard Navigation (workaround to table bug)
salaryReviewsTable.getColumns().forEach(column -> {
if (!column.isEditable()) {
column.setColumnGenerator(project -> {
MetaPropertyPath mpp = column.getMetaPropertyPathNN();
Object value = project.getValueEx(mpp);
return new Table.PlainTextCell(metadataTools.format(value));
});
}
});
}
However, the side effect is, a column “increase percentage” is not showing up any update anymore when I update the “increase amount” column.
Thank you Roman. It worked. I have coded as follows. Do I have to maintain both for “IncreasePercent” and “else” or only the code within the “increassePercent” will do for all the uneditable columns?
//for smooth keyboard Navigation (workaround to table bug)
salaryReviewsTable.getColumns().forEach(column -> {
if (!column.isEditable()) {
column.setColumnGenerator(project -> {
if ("increasePercent".equals(column.getIdString())) {
Label<String> label = uiComponents.create(Label.NAME);
label.setValueSource(
new ContainerValueSource<>(
salaryReviewsTable.getInstanceContainer(project), "increasePercent"));
return label;
}else {
MetaPropertyPath mpp = column.getMetaPropertyPathNN();
Object value = project.getValueEx(mpp);
return new Table.PlainTextCell(metadataTools.format(value));
}
});
}
});
Label component is needed only for the increasePercent column because it depends on runtime changes in the entity and should be notified. Table.PlainTextCell does not provide data binding as it is the lightweight component for the table.