TableView

For TableView with SFXBean objects create an ObservableList and use the property attribute in SFXTableValueFactory tag.

Usage in SFXViewController

Hint

To convert List[FXBean] to ObservableList you can use the trait SFXBeanConversions

source@FXML
var table: TableView[SFXBean[Person]] = _

override def didGainVisibilityFirstTime(): Unit = {
  super.didGainVisibilityFirstTime()
  val items: ObservableList[SFXBean[Person]] = PersonDatabase.smallPersonList
  table.setItems(items)
}

FXML Sample

source<TableView fx:id="table" BorderPane.alignment="CENTER">
    <columns>
        <TableColumn  text="Name">
            <cellValueFactory>
                <SFXTableValueFactory property="name" />
            </cellValueFactory>
        </TableColumn>
        <TableColumn  text="Company">
            <cellValueFactory>
                <SFXTableValueFactory property="company" />
            </cellValueFactory>
        </TableColumn>
        <TableColumn  text="Expression Test1 ">
            <cellValueFactory>
                <SFXTableValueFactory property="!{_self.age()} / !{_self.gender()}" />
            </cellValueFactory>
        </TableColumn>
        <TableColumn  text="Expression Test 2">
            <cellValueFactory>
                <SFXTableValueFactory property="!{simplePersonTableController.testString()}" />
            </cellValueFactory>
        </TableColumn>
        <TableColumn  text="Balance">
            <cellValueFactory>
                <SFXTableValueFactory property="balance" format="#,##0.00" />
            </cellValueFactory>
            <cellFactory>
                <SFXTableCellFactory alignment="right"/>
            </cellFactory>
        </TableColumn>
        <TableColumn  text="Active">
            <cellValueFactory>
                <SFXTableValueFactory property="isActive" />
            </cellValueFactory>
        </TableColumn>
        <TableColumn  text="Checkbox Test">
            <cellValueFactory>
                <SFXTableValueFactory property="isActive" />
            </cellValueFactory>
            <cellFactory>
                <SFXTableCellFactory simpleClassName="CheckBoxTableCell" alignment="right"/>
            </cellFactory>
        </TableColumn>
    </columns>
</TableView>