I have a TableView and some POJOs and want to bind with a property from one of them to the TableView.
However, this property is also a POJO and this should get one property to show in the TableView.
Here's my code:
<TableView fx:id="listaDeudores" layoutX="85.0" layoutY="7.0" prefHeight="200.0" prefWidth="200.0">
<columns>
<TableColumn prefWidth="75.0" text="Archivo">
<cellValueFactory>
<PropertyValueFactory property="archivo" />
</cellValueFactory>
<cellFactory>
<FormattedTableCellFactory alignment="center" />
</cellFactory>
</TableColumn>
<TableColumn prefWidth="299.0" text="Nombres">
<cellValueFactory>
<PropertyValueFactory property="nombres" />
</cellValueFactory>
<cellFactory>
<FormattedTableCellFactory alignment="center" />
</cellFactory>
</TableColumn>
<TableColumn minWidth="0.0" prefWidth="95.0" text="Actual" >
<cellValueFactory>
<PropertyValueFactory property="deuda.saldo" />
</cellValueFactory>
<cellFactory>
<FormattedTableCellFactory alignment="center" />
</cellFactory>
</TableColumn>
<TableColumn prefWidth="75.0" text="Nueva" />
<TableColumn prefWidth="75.0" text="Parcial" />
</columns>
</TableView>`
And my Persona
and Deuda
classes:
public class Persona {
private Integer id;
private Integer archivo;
private String Nombres;
private List<Recibo> recibos;
private Deuda deuda;
}
public class Deuda {
private Date fecha;
private BigDecimal saldo;
private BigDecimal nuevo;
private BigDecimal descuento;
}
I want to set Person.deuda.saldo in fxml file, so I used:
<TableColumn minWidth="0.0" prefWidth="95.0" text="Actual" >
<cellValueFactory>
<PropertyValueFactory property="deuda.saldo" />
</cellValueFactory>
<cellFactory>
<FormattedTableCellFactory alignment="center" />
</cellFactory>
</TableColumn>
but this won't render anything in my TableView. How can I fix this?