Issue
How to detect, which column(name or id whatever) was selected when user clicked on certain cell?
Solution
To enable individual cells to be selected, instead of entire rows, call
tableView.getSelectionModel().setCellSelectionEnabled(true);
To keep track of which cell(s) are selected, you can do
final ObservableList<TablePosition> selectedCells = table.getSelectionModel().getSelectedCells();
selectedCells.addListener(new ListChangeListener<TablePosition>() {
@Override
public void onChanged(Change change) {
for (TablePosition pos : selectedCells) {
System.out.println("Cell selected in row "+pos.getRow()+" and column "+pos.getTableColumn().getText());
}
});
});
Answered By - James_D