I am using a TableView which is populated by my model.
I want to use a spinner control in one column.
I am able to create the spinner in the cells in the desired column, but I am struggling to bind the spinners value to the models property.
This is the fxml
<ScrollPane> <content> <TableView prefHeight="525.0" prefWidth="814.0"> <columns> <TableColumn prefWidth="75.0"> <cellValueFactory><PropertyValueFactory property="state"/></cellValueFactory> </TableColumn> <TableColumn prefWidth="75.0" text="Side"> <cellValueFactory><PropertyValueFactory property="side"/></cellValueFactory> </TableColumn> <TableColumn prefWidth="75.0" text="Source"> <cellValueFactory><PropertyValueFactory property="sourceContract"/></cellValueFactory> </TableColumn> <TableColumn prefWidth="75.0" text="Reference"> <cellValueFactory><PropertyValueFactory property="referenceContract"/></cellValueFactory> </TableColumn> <TableColumn prefWidth="75.0" text="Destination"> <cellValueFactory><PropertyValueFactory property="destinationContract"/></cellValueFactory> </TableColumn> <TableColumn prefWidth="75.0" text="Margin" editable="true"> <cellFactory><SpinnerTableCellFactory /></cellFactory> <cellValueFactory><PropertyValueFactory property="margin"/></cellValueFactory> </TableColumn> <TableColumn prefWidth="75.0" text="Bot"> <cellValueFactory><PropertyValueFactory property="bot"/></cellValueFactory> </TableColumn> <TableColumn prefWidth="75.0" text="Price"> <cellValueFactory><PropertyValueFactory property="price"/></cellValueFactory> </TableColumn> <TableColumn prefWidth="75.0" text="Volume"> <cellValueFactory><PropertyValueFactory property="volume"/></cellValueFactory> </TableColumn> </columns> <items> <FXCollections fx:factory="observableArrayList"> <GridRowModel state="false" side="BID" sourceContract="s01" referenceContract="" destinationContract="d01" margin="0" bot="MinMax" price="15.125" volume="0" /> <GridRowModel state="false" side="ASK" sourceContract="s02" referenceContract="" destinationContract="d02" margin="0" bot="MinMax" price="15.125" volume="0" /> </FXCollections> </items> </TableView> </content> </ScrollPane> And this is the SpinnerTableCellFactory
public class SpinnerTableCellFactory<S, T> implements Callback<TableColumn<S, Double>, TableCell<S, Double>> { @Override public TableCell<S, Double> call(TableColumn<S, Double> param) { return new TableCell<S, Double>() { Spinner<Double> spinner = new Spinner<>(0d, 1d, 0d, 0.025d); protected void updateItem(Double item, boolean empty) { super.updateItem(item, empty); if (empty) { setText(null); setGraphic(null); } else { if (isEditing()) { setText(null); setGraphic(null); } else { spinner.getValueFactory().setValue(getItem()); setText(null); setGraphic(spinner); } } }; }; } } When the fxml is loaded the updateItem method is called with the default values from the fxml for the margin property. I can see and use the spinner in the cells. But how do I pass any new spinner value back to the margin property in the GridRowModel object?