I have a table with a column. Initially, the table is blank. I need to enter values at cell like Excel. I followed the question javafx-table-cell-editing and also JAVA Tutorial on TableView.
I coded like:
colCom1.setCellValueFactory(new PropertyValueFactory<>("C1"));
colCom1.setCellFactory(TextFieldTableCell.forTableColumn ());
colCom1.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<commonDataClass, String>>() {
@Override
public void handle(TableColumn.CellEditEvent<commonDataClass, String> t) {
((commonDataClass) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setD1(t.getNewValue().toString());
tC1.setItems(myC1);
System.out.println("Col1->" + colCom1.isVisible());
tC1.refresh();
tC1.setVisible(true);
}
}
});
The issue I am facing is that after editing and pressing "ENTER" nothing appears in the cell (cell remains blank) while printing of data reveals that value has been properly entered.