0

I have one issue with my application which is solved using refresh() method of TableView. But this method is available since JavaFX 8u60. Our production environment uses build version prior to that. Can anyone let me know which method should I use in prior versions?

Neeraj Sewani
  • 3,952
  • 6
  • 38
  • 55
Hemant Rajput
  • 259
  • 2
  • 14
  • 1
    Why can't you upgrade? Different updates of the same Java major version should be backwards-compatible. To answer the question - you can hide and show any column, which should have a similar effect to calling `TableView::refresh`. – Itai Jun 04 '18 at 10:38
  • I tried using the below mentioned code but it doesn't seem to work. for(int i=0 ; i – Hemant Rajput Jun 04 '18 at 10:40
  • The application is very old and it is huge. So upgrade may cost a fortune. – Hemant Rajput Jun 04 '18 at 10:42
  • 1
    Upgrading from java 8 update X to java 8 update Y > X??? – fabian Jun 04 '18 at 10:56
  • Possible duplicate of [JavaFX 2.1 TableView refresh items](https://stackoverflow.com/questions/11065140/javafx-2-1-tableview-refresh-items) – fabian Jun 04 '18 at 10:56
  • I tried the above link as well but it didn't work. The problem I am facing is I am seeing duplicate records in my Table even though I am using table.getItems().clear(); followed by table.getItems().addAll(...). I am not sure why it is not clearing those or what kind of cache it is keeing it. – Hemant Rajput Jun 04 '18 at 11:50
  • So recreating or re-rendering the rows in the table helps me solve this probem. refresh() method does it. – Hemant Rajput Jun 04 '18 at 11:52
  • Please edit your question to include a [mcve] - it is possible there is a problem somewhere else in the code, i.e. a problematic implementation of a cell/cell factory etc., but it is impossible to tell without a code reproducing the problem. – Itai Jun 04 '18 at 12:41
  • The issue got solved by using the body of refresh() method. – Hemant Rajput Jun 04 '18 at 13:36

1 Answers1

0

I was able to fix the issue by using the body of refresh() method. I was unable to use refresh() method in prior versions to mentioned version as the method was private. So I used the body of refresh() instead of refresh().

table.getProperties().put(TableViewSkinBase.RECREATE, Boolean.TRUE);
Hemant Rajput
  • 259
  • 2
  • 14