• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Refresh TableView (in fxml A controller) on button event in fxml B controller  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to make a table, which would refresh and display all new values whenever a new value is added to it. More specifically, I need to have the TableView(in fxml A controller) refresh on certain button event in fxml B controller. So far, when the button is clicked, the object is successfully created and stored in an array list. But the table does not display this new value right after. Only after I restart the app I can see that the new value has been added to the table. Been looking for a way to somehow work this out, but with no luck. It's probably worth to mention that I've created the GUI panels in SceneBuilder and then added the fxml files to the java project.

Any help is much appreciated! Thanks

Here is the main controller(fxml A) code:



And here is the secondary controller (fxml B) code:



Member constructor:



Main program:


 
Sheriff
Posts: 5033
138
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may be getting old, but I don't see where you are adding a new member to tableViewB.

Regardless, try this right after you add the member: This requires at least Java 8u60.

Java Docs wrote:Calling refresh() forces the TableView control to recreate and repopulate the cells necessary to populate the visual bounds of the control. In other words, this forces the TableView to update what it is showing to the user. This is useful in cases where the underlying data source has changed in a way that is not observed by the TableView itself.Since:JavaFX 8u60

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!