如何在 Table View javafx 中使用 ComboBoxTableCell 或 ChoiceBoxTableCell select 多个值

How to select multiple values by using ComboBoxTableCell or ChoiceBoxTableCell in Table View javafx

我有一个表格视图,用户可以在其中双击列行,组合框下拉列表将显示项目列表。这里的问题是用户一次只能 select 一个值,而不是我想允许用户 select 多个值。

使用 ComboBoxTableCell 的现有实现

List<TableColumn<DITComparatorFileColumnConfigDO, ?>> columnList = new ArrayList<TableColumn<DITComparatorFileColumnConfigDO, ?>>();
TableColumn<DITComparatorFileColumnConfigDO, String> column = null;

column.setCellValueFactory(new PropertyValueFactory<DITComparatorFileColumnConfigDO, String>("primaryColumn"));
column.setCellFactory(ComboBoxTableCell.forTableColumn(FXCollections.observableArrayList(primaryFileHeaders)));
columnList.add(column);

[]

使用 ChoiceBoxTableCell 的现有实现

column.setCellValueFactory(new PropertyValueFactory<DITComparatorFileColumnConfigDO, String>("secondaryColumn"));    
column.setCellFactory(ChoiceBoxTableCell.forTableColumn(FXCollections.observableArrayList(secondaryFileHeaders)));
columnList.add(column);

I have implemented TurekBot CheckComboBoxTableCell which uses ComboBoxTableCell and CellUtils implementations by replacing checkBox to contolFX checkComboBox in it's original file.

Link to solution

Screenshot from my application