SetCellValueFactory to data object in JavaFX TableColumn
I have a tablecolumn with custom cell render this cell render takes an
object and renders its properties as Labels. The problem is that I can't
find a way to pass the same object in the arraylist to a column. Here is
my code:
//I want to render this object in a column as well as use it in the rest
of columns
CustomerCreationFlow cflow=new CustomerCreationFlow();
cflow.setId(10L);
cflow.setFirstName("Feras");
cflow.setLastName("Odeh");
cflow.setCustomerType("type");
ObservableList<CustomerCreationFlow> data =
FXCollections.observableArrayList(cflow);
idclm.setCellValueFactory(new
PropertyValueFactory<CustomerCreationFlow, String>("id"));
//I tried this but it didn't work
flowclm.setCellValueFactory(new
PropertyValueFactory<CustomerCreationFlow,
CustomerCreationFlow>("this"));
typeclm.setCellValueFactory(new
PropertyValueFactory<CustomerCreationFlow,
String>("customerType"));
flowTable.setItems(data);
Any Suggestion?
No comments:
Post a Comment