I'm working on a scalafx project and I'd like a TableView where some of the Cells contain a button. I've found an example of how to put a graphic inside of a tablecell. When I use example and only replace the call to graphic = ...
to use a button I will sometimes get Cells where every column is empty except the one whith the button:
How do i fix this? (I've checked that it's not just an empty string on the name value, so that last login button should not be there)
Here is the code from the example modified to use a button:
new TableColumn[Person, String] {
text = "Login"
cellValueFactory = { _.value.favoriteColor }
cellFactory = { _ =>
new TableCell[Person, String] {
item.onChange { (_, _, newColor) =>
graphic = new Button {
text = "Login"
onAction = {
(e: ActionEvent) => println("pressed the button")
}
}
}
}
}
}