I have this common issue, as it appears to be. My table view wont refresh my items after I reset them. I have checked the data and it's the new one.
I tried multiple solution from internet but no success.
Can't reset all the columns because it adds one empty one extra (dont know why) and the resize just breakes.
My table is not editable. The new data is changed.
The data is refreshed if I change the ordering of the items and the rows change (:|).
I'm just left without ideas.
At the moment the refresh code is pretty simple.
ObservableList<User> data = FXCollections.observableArrayList(User.getResellers());
reseller_table.setItems(data);
Again the new data is correct. When I make an selection to the tableView it returns the new correct Item.
Workaround:
What a BUG ! Here is another workaround...
I've done a SSCCE to show the bug. I encourage everyone to fix it by another more elegant way because my workaround is very ugly!
initialize() method
User Class (Hibernate POJO Class)
refresh() method
UPDATE:
Finally tableview refreshing is resolved in JavaFX 8u60, which is available for early access.
About refreshing see the Updating rows in Tableview.
And about the blank column see the JavaFx 2 create TableView with single column. Basically it is not a column, i.e. you cannot select the item clicking on this blank column items. It is just a blank area styled like a row.
UPDATE: If you are updating the tableView via
reseller_table.setItems(data)
then you don't need to useSimpleStringProperty
. It would be useful if you were updating one row/item only. Here is a working full example of refreshing the table data:Note that
and
are almost equivalent. So I used the one to fill the table for the first time and other when the table is refreshed. It is for demo purposes only. I have tested the code in JavaFX 2.1. And finally, you can (and should) edit your question to improve it by moving the code pieces in your answer to your question.
Following the answer of Daniel De León ...
-
I finally found an ugly workaround to refresh all rows.