Reputation: 267
If I run the program then the only column that will be filled in the table will be the "description" column. Still, if I click on the row then it shows me all the details that should be shown in the table.
Here is the source code that I have written: http://pastebin.com/Se3DnxJT
I have tried working along examples I have found but I don't see the issue in my code.
Can anyone help me by telling me what I have done wrong?
Upvotes: 0
Views: 518
Reputation: 36722
Your cellValueFactory
is not properly configured. The constructor of PropertyValueFactory
accepts the name of the field and not the text to be displayed on the TableColumn. So the declaration of the columns should be as follows :
TableColumn designIdCol = new TableColumn("Design ID");
designIdCol.setCellValueFactory(new PropertyValueFactory<Design, String>("id"));
TableColumn designNameCol = new TableColumn("Design Name");
designNameCol.setCellValueFactory(new PropertyValueFactory<Design, String>("name"));
TableColumn printsAvailableCol = new TableColumn("Prints Available");
printsAvailableCol.setCellValueFactory(
new PropertyValueFactory<Design, String>("availability"));
TableColumn partDescriptionCol = new TableColumn("Description");
partDescriptionCol.setCellValueFactory(
new PropertyValueFactory<Design, String>("description"));
Upvotes: 1