title: javafx unable to edit tableview row data
body: <p>i want to edit tableview row data i had some codes which edit cell data but it is not working in my project 
  fxml code:</p>
  
  <pre><code>&lt;TableView fx:id="table" layoutX="112.0" layoutY="25.0" prefHeight="430.0" prefWidth="505.0"&gt;
                             &lt;columns&gt;
                                &lt;TableColumn fx:id="tablecol" prefWidth="490.0" text="Schedule Item"&gt;
                                    &lt;cellValueFactory&gt;
                        &lt;PropertyValueFactory property="firstName" /&gt;
                    &lt;/cellValueFactory&gt;&lt;/TableColumn&gt;
                             &lt;/columns&gt;
                          &lt;/TableView&gt;
  </code></pre>
  
  <p>in fxml <code>fx:id="tablecol"</code> and <code>fx:id="table"</code> are used</p>
  
  <p>code:</p>
  
  <pre><code>@FXML
      private TableView&lt;person1&gt; table;
   @FXML
      private TableColumn&lt;person1, String&gt; tablecol;
      /**
       * Initializes the controller class.
       */
      @Override
      public void initialize(URL url, ResourceBundle rb) {
  
   tablecol.setCellFactory(TextFieldTableCell.forTableColumn());
  tablecol.setOnEditCommit(
      new EventHandler&lt;CellEditEvent&lt;person1, String&gt;&gt;() {
          @Override
          public void handle(CellEditEvent&lt;person1, String&gt; t) {
              ((person1) t.getTableView().getItems().get(
                  t.getTablePosition().getRow())
                  ).setFirstName(t.getNewValue());
          }
      }
  );         try{
         Class.forName("com.mysql.jdbc.Driver");
              Connection con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/schoolmanagement","root","root");
              String sql="SELECT * FROM `scheduleitem` ";
             Statement stm=(Statement) con.createStatement();
  ResultSet rs=stm.executeQuery(sql);
  while(rs.next()){
  
     table.getItems().add(new person1(rs.getString(2)));
  }
  
          } 
          catch (ClassNotFoundException | SQLException e) {
  
          }
      }    
   }
  
  
      public class person1 {
      private final StringProperty firstName = new SimpleStringProperty("");
  
      public person1(String firstName) {
          setFirstName(firstName);
  
      }
  
      public String getFirstName() {
          return firstName.get();
      }
  
      public void setFirstName(String name) {
          this.firstName.set(name);
      }
  
      public StringProperty firstNameProperty() {
          return firstName;
      }
  </code></pre>
  
  <p>please help why i am unable to edit the cell data.</p>
  
  <p>Thank you.</p>