ComboBoxTableCell JavaFX

I have something like this class with ArrayList of LocalDate

public class Item {
    private ArrayList<LocalDate> dates;
}

And a TableColumn in another class

ObservableList<Item> itemObservableList = FXCollections.observableArrayList();
TableColumn<Item, LocalDate> datesColumn = new TableColumn<>("Dates");
datesColumn.setCellFactory(param -> new ComboBoxTableCell<>());

I figured how to set a cellValueFactory for this column, now i want ComboBoxTableCell to have values from object of Item class. So every ComboBox should have it’s own values based on Item object.

You can @Override the ComboBoxTableCell’s startEdit() method like this:

datesColumn.setCellFactory(param -> new ComboBoxTableCell<Item,LocalDate>(){
      @Override public void startEdit() {
                Item item = (Item)getTableRow().getItem();
                getItems().setAll(item.getDates());
                super.startEdit();
        }
});

So you will have the dates in your comboBoxes for each individual row with its Item’s dates. You may define a StringConverter<LocalDate> for it.