title: Javafx Tableview save data without enter key
body: <p>I tried to find a solution to save data for my editable cell direct without pressing enter to save it. Most solutions were for starting editing without double click(I implemented that) and I saw no solution for saving data without enter key.
  So based on my knowledge and research I didn't find anything to help me, is this what I'm asking possible and how to do it?</p>
  
  <p>Edited:</p>
  
  <pre><code>@FXML
  private TableView tableVeiwResults;
  @FXML
  private TableColumn colAnalysis;
  @FXML
  private TableColumn colResult;
  private AnalysisPacientDetailsJpaController apdjpa = new 
  AnalysisPacientDetailsJpaController(emf);
  
   colAnalysis.setCellValueFactory(new Callback&lt;TableColumn.CellDataFeatures&lt;AnalysisPacientDetails, String&gt;, ObservableValue&lt;String&gt;&gt;() {
          @Override
          public ObservableValue&lt;String&gt; call(TableColumn.CellDataFeatures&lt;AnalysisPacientDetails, String&gt; param) {
              return new SimpleStringProperty((param.getValue()).getIdAnalysis().getAnalysisName());
  
          }
      });
  
  
   colResult.setCellValueFactory(new Callback&lt;TableColumn.CellDataFeatures&lt;AnalysisPacientDetails, String&gt;, ObservableValue&lt;String&gt;&gt;() {
          @Override
          public ObservableValue&lt;String&gt; call(TableColumn.CellDataFeatures&lt;AnalysisPacientDetails, String&gt; param) {
              return new SimpleStringProperty((param.getValue()).getAnalysisPacientDetailsResults());
          }
      });
  
   colResult.setOnEditCommit(new EventHandler&lt;TableColumn.CellEditEvent&lt;AnalysisPacientDetails, String&gt;&gt;() {
          @Override
          public void handle(TableColumn.CellEditEvent&lt;AnalysisPacientDetails, String&gt; event) {
              try {
  
                  String newValue = event.getNewValue();
                  if (newValue == null || newValue.trim().isEmpty()) {
                      return;
                  }
  
  AnalysisPacientDetails apdRes = (AnalysisPacientDetails) tableVeiwResults.getSelectionModel().getSelectedItem();
  
  
  apdRes.setAnalysisPacientDetailsRezultat(event.getNewValue());
  
                  apdjpa.edit(apdRes);
  
  tableVeiwResults.refresh();
                  TablePosition pos = tableVeiwResults.getFocusModel().getFocusedCell();
                  if (pos.getRow() &lt; tableVeiwResults.getItems().size() - 1) {
  
  tableVeiwResults.getSelectionModel().clearAndSelect(pos.getRow() + 1, pos.getTableColumn());
                  }
              } catch (Exception ex) {
                  ex.printStackTrace();
              }
    }
  });
  </code></pre>