This is my first time creating a topic.
I have a TreeTableView with a few not editable TreeTableColumn, that are not the relevant, and one editable that is the reason of this topic. It's always necessary to double click to start editing the cell, or one click and one ENTER key. As my treeTableView may have a lot of rows, it may be kind of exhausting take one hand off the keybord and click to open the cell to edit the new value repteatly.
@FXML
private TreeTableView<CelulaTabelaLoteDigitar> tabela = new TreeTableView<>();
private TreeTableColumn<CelulaTabelaLoteDigitar, String> columnPrecoAtual = new TreeTableColumn<>("PREÇO ATUAL");
So, I want to do something like Excel does. After commiting a cell value with ENTER key, I want to go to the next row same column and be able to edit it too without being necessary to use mouse or arrows. I would like to do that only with one ENTER key, but It can be twice, one to commit and the other to open the cell to start edit.
I realized that after commiting a value the table lose focus, so I give it back and selected the next row inside of method setOnEditCommit. But the problem is that the row has others columns and I do not know how to "click" the column by code, so pressing ENTER key to open the cell doesn't work, since the column isn't selected.
columnPrecoAtual.setOnEditCommit(
new EventHandler<TreeTableColumn.CellEditEvent<CelulaTabelaLoteDigitar, String>>() {
@Override
public void handle(TreeTableColumn.CellEditEvent<CelulaTabelaLoteDigitar, String> event) {
TreeItem<CelulaTabelaLoteDigitar> rowValue = event.getRowValue();
// ... code ...
TreeItem<CelulaTabelaLoteDigitar> nextSibling = rowValue.nextSibling();
tabela.requestFocus();
tabela.getSelectionModel().select(nextSibling);
// something to open the cell in column columnPrecoAtual in the nextSibling row OR
// something to select the column columnPrecoAtual
}
});
In short, after ENTER key to commit I would like to start editing the next row if exists without using mouse or arrows. I want to start a CellEditEvent.