I'm trying to find some sample code to update my TableView from inside my controller. If possible I want to make my TableView with fxml.
def addPerson(event: ActionEvent) {
// how do I access my TableView items?
}
My TableView looks like:
<TableView fx:id="tableView"></TableView>
Also, what's a good way to interactively inspect stage objects and methods?
In order to use it, you need to pass it in as a parameter which will be shown below :
@sfxml
class PersonOverviewController(
private val tableView : TableView[S] //S -> The type of the objects contained within the TableView items list.
) {
def addPerson(event: ActionEvent) {
// do whatever you want here with tableView
val selectedIndex = tableView.selectionModel().selectedIndex.value //just for example
}
}