我有一個表格,它有一個組合單元格,您可以從每個行條目中選擇一個值。問題是,下拉列表僅顯示單元格正在編輯時的情況,我希望它始終顯示在每一行上。這是可能的,如果是這樣,如何?Java FX ComboBoxTableCell在每個單元格中顯示
TableColumn<Product, String> actionsCol = new TableColumn<Product, String>("Exception Reason");
actionsCol.setCellValueFactory(new PropertyValueFactory("exceptionReason"));
actionsCol.setCellFactory(ComboBoxTableCell.forTableColumn(exceptionReasons));
actionsCol.setOnEditCommit(
new EventHandler<CellEditEvent<Product, String>>() {
@Override
public void handle(CellEditEvent<Product, String> t) {
((Product) t.getTableView().getItems().get(t.getTablePosition().getRow())).setExceptionReason(t.getNewValue());
};
});
actionsCol.setEditable(true);
您需要發佈您的代碼產生此結果在這裏。 – ManoDestra
@ManoDestra - 問題更新列代碼 – Ashley