Adding person.city.name to a TableView

后端 未结 1 1731
孤街浪徒
孤街浪徒 2021-01-25 23:24

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 prope

相关标签:
1条回答
  • 2021-01-26 00:15

    You can't use a PropertyValueFactory to do this: you need to implement the Callback directly.

    Put an fx:id="actualColumn" on the table column, inject the column into your controller with

    @FXML
    private TableColumn<Persona, BigDecimal> actualColumn ;
    

    and in your controller's initialize() method, do:

    actualColumn.setCellValueFactory(cellData -> 
        new ReadOnlyObjectWrapper<BigDecimal>(cellData.getValue().getDeuda().getSaldo()));
    
    0 讨论(0)
提交回复
热议问题