Adding values to selected javafx ComboBoxTableCell dynamically

Viewed 1185

I have a TableView with two columns named Product and Brand. A Product can be of different Brands. Eg. TV has different brands like Samsung, Sony etc. I am showing Brands of a Product in ComboBoxes.

This is how i am adding a ComboBoxTableCell for my Brand Column.

    ObservableList<String> catList = FXCollections.observableArrayList();

    categoryCol.setCellFactory(t -> {   
        ComboBoxTableCell comboCell = new ComboBoxTableCell(catList);
        return comboCell;
    });
    contactTable.getColumns().add(categoryCol);

Now in these ComboBoxes i want to add values of Brands. Since There will be different Products so their Brands will be different also. Eg.

Product  |  Model
----------------------------------------------
TV       |  ComboBox[Samsung, Sony, Panasonic] 
Monitor  |  ComboBox[Dell, Microsoft, Apple ]

Now since the ComboBoxes have same data model (ObservableList) how can i add different values to them by selecting the items in table. Is it possible to do ? Thanks in advance for any help.

1 Answers
Related