After some experimenting I think I found why the 'leaf' Table Columns wont work.
When you add them, it basically screws up the cell factories for every cell to their right.
it is possible to get them working in pure java, but not from B4J (yet).
(Erel if the code is useful feel free to use it.)
public void addLeafColumns(TableColumn t, String... names) {
int i = t.getTableView().getVisibleLeafColumns().indexOf(t);
for (String a : names) {
TableColumn x = new TableColumn<>(a);
x.setCellValueFactory(new TestCellValueFactory(i));
if (i==0) {
t.getColumns().add(x);
}else{
t.getColumns().add(i, x);
}
i++;
}
correctCellValueFactory(t.getTableView());
}
public void correctCellValueFactory(TableView t) {
t.getColumns().forEach(
tc -> {
((TableColumn) tc).setCellValueFactory(
new TestCellValueFactory(((TableColumn) tc).getTableView().getVisibleLeafColumns().indexOf(tc)));
});
}
just call correctCellValueFactory after adding leaf or normal columns to the table.