I want to bind a collection of items to a TableView in GroovyFX, but I'm not getting the table updated after tableView()
is called.
I can update the table in JavaFX, but not in GroovyFX. I guess there's some binding missing.
Code is
import static groovyx.javafx.GroovyFX.start
import groovyx.javafx.beans.FXBindable;
import javafx.scene.control.TableView
class Command {
@FXBindable String command
@FXBindable String target
@FXBindable String value
}
start{
TableView scriptTable
ObservableList<Command> script = []
stage(title: 'Example for Stackoverflow', visible: true) {
scene(fill: groovyblue, width: 600, height: 250) {
borderPane{
center(align: CENTER){
script.add( new Command(command: "a", value: "b", target: "c") )
scriptTable = tableView(items: script, editable: true){
tableColumn(text: "Command", property: "command"){}
tableColumn(text: "Target", property: "target"){}
tableColumn(text: "Value", property: "value"){}
}
script.add( new Command(command: "d", value: "e", target: "f") )
}
}
}
}
In this example I get a single row with "a, b, c".
Help is appreciated on how to update the table with data ("d, e, f") after its creation.
Many thanks.