title: Dynamically add check box and records from database in javaFX 2.2 Table View
body: <p>I am writing a client-server java FX application with a table View. I have a database in the server side and I want from the Client to load the table Columns and table Records from the db to a table View dynamically. So far I have found many hints, on how to do this successfully. The thing is that I want to add to the table a column 'select' which is a check box. Below is my code.</p>
  
  <pre><code>private void AddToTableRecordsFromDB(TabPane tp){
      tableview = (TableView) tp.lookup("#table");
      ObservableList&lt;Object&gt; data = null;
      try {
          String[] columnNames = (String[]) Login.Login.in.readObject();
          ArrayList&lt;ArrayList&gt; al = (ArrayList&lt;ArrayList&gt;) Login.Login.in.readObject();
          /**********************************
           * TABLE COLUMN ADDED DYNAMICALLY *
           **********************************/
                  TableColumn select = new TableColumn("Select");
                  select.setCellValueFactory(new PropertyValueFactory("invited"));
                  select.setCellFactory(new Callback&lt;TableColumn&lt;ObservableValue, Boolean&gt;, TableCell&lt;ObservableValue, Boolean&gt;&gt;() {
  
                      public TableCell&lt;ObservableValue, Boolean&gt; call(TableColumn&lt;ObservableValue, Boolean&gt; p) {
                          return new CheckBoxTableCell&lt;ObservableValue, Boolean&gt;();
                      }
                  });
                  tableview.getColumns().add(select);
  
          for(int i=0 ; i&lt;columnNames.length; i++){
              //use non property style for making dynamic table
              final int j = i;  
              TableColumn col;
                  col = new TableColumn(columnNames[i]);
                  col.setCellValueFactory(new Callback&lt;CellDataFeatures&lt;ObservableList,String&gt;,ObservableValue&lt;String&gt;&gt;(){                   
                      @Override
                      public ObservableValue&lt;String&gt; call(CellDataFeatures&lt;ObservableList, String&gt; param) {                                                                                             
                          return new SimpleStringProperty(param.getValue().get(j).toString());                     
                      }                   
                  });                  
  
              tableview.getColumns().add(col);
          }
          /********************************
           * Data added to ObservableList *
           ********************************/
          data = FXCollections.observableArrayList();
  
          for(int i=0 ; i&lt;al.size(); i++){
              ObservableList&lt;ArrayList&gt; row = FXCollections.observableArrayList(al.get(i));
              data.add(row);
          }
          //FINALLY ADDED TO TableView
          tableview.setItems(data);
  
      } catch (IOException | ClassNotFoundException ex) {
          Logger.getLogger(Developer_Main.class.getName()).log(Level.SEVERE, null, ex);
      } 
  
  }
  </code></pre>
  
  <p>I took the CheckBoxTableCell class from the JavaFX2.0 Ensemble.
  The database loads successfully in to the table view and also my 'select' column is created, but I can not see any check boxes in the rows.</p>
  
  <p>Any help please ?</p>