I am working on a JavaFX application with a tree table view where the columns are generated based on the provided data. However, in some cases, when an update comes in from the back end, a "ghost row" is created. This is an additional row that has the same values as an existing row, but cannot be selected. If the window is left open long enough, these ghost rows fill up the rest of the visible table rows (but do not create a scroll bar).
I have added some debugging logic in my Cell Value Factory callback, but the data source still indicates that it only has 5 entries despite 6 or more being visible on the screen. For some reason, it just seems to be rendering another copy of the same row.
Does anyone have any thoughts on what could be causing this?
Thanks.
EDIT:
Here's the UpdateItem method in the TreeTableCell implementation:
super.updateItem(item, empty);
FlowPane flow = new FlowPane();
if (item != null && !empty && getTreeTableRow() != null)
{
Node cellGraphic = item.getGraphic();
if (cellGraphic != null
&& cellGraphic.getClass().equals(Button.class))
{
item.setAlignment(Pos.CENTER);
}
flow.getChildren().add(item);
item.prefWidthProperty().bind(flow.prefWrapLengthProperty());
flow.prefWrapLengthProperty().bind(
getTableColumn().widthProperty());
setGraphic(flow);
return;
}