2 Replies Latest reply: Mar 8, 2013 9:10 AM by Celer RSS

    getting tableCell value from TableColumn

    Celer
      Is there a way to get the underlying table cell value from a tableColumn object?
        • 1. Re: getting tableCell value from TableColumn
          James_D
          It's hard (but not impossible, I suppose) to envisage a scenario where you wouldn't be able to get the value by some other, more immediate, logic. (You presumably know what the particular column is displaying, which table it's attached to, and what the items are for that table...). But to answer the question as stated, I suppose you could do something like
          TableColumn column = // the column ;
          int rowIndex = // the index of the row for which you want the value ;
          TableView table = column.getTableView();
          Object item = table.getItems().get(rowIndex);
          TableColumn.CellDataFeatures cdf = new TableColumn.CellDataFeatures(table, column, item);
          Object cellValue = column.getCellValueFactory().call(cdf);
          I haven't tested this. It seems very backwards to me: effectively using the view (table view and table column) to access the model (the data).
          • 2. Re: getting tableCell value from TableColumn
            Celer
            Thanks will give it a go