I updated my code to show how the whole class look like Still I got some errors can you validate what I need to improve to have it working
Mainly the problem is with fi
You need to update the items of Table View by overriding updateItem()
method.
The code is :
yourColumnBased.setCellFactory(column -> {
return new TableCell<CarFx, String>() {
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
setText(empty ? "" : getItem().toString());
setGraphic(null);
TableRow<CarFx> currentRow = getTableRow();
if (!isEmpty()) {
if(item.equals("assigned"))
currentRow.setStyle("-fx-background-color:blue");
else
currentRow.setStyle("-fx-background-color:green");
}
}
};
});