aspose file tools*
The moose likes JavaFX and the fly likes Trying to populate data from database in tableview using javafx mvc architecture. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JavaFX
Bookmark "Trying to populate data from database in tableview using javafx mvc architecture." Watch "Trying to populate data from database in tableview using javafx mvc architecture." New topic
Author

Trying to populate data from database in tableview using javafx mvc architecture.

Tanushree Gundalwar
Greenhorn

Joined: Jul 05, 2014
Posts: 1
In the following code i am trying to populate data from database into tableview using MVC architecture. I am getting a complete row in each column which is not my requirement.
I want to populate tableview with database table as it is.Same code is working fine without MVC architecture in javafx.Please consider the following code.

Controller code is as follows:


model part:

Hendrik Ebbers
author
Ranch Hand

Joined: Jun 24, 2014
Posts: 32
    
    6
Hi,

first of all you should think about concurrency issues. You are calling the sql statement on the JavaFX Application Thread. Because it could take some time to call the statement the application thread can't handle user interaction or repaint the ui. In this case the application is frozen. Maybe you can check DataFX (www.javafxdata.org) because it handles this issues.

About your problem:
With "col.setCellValueFactory" you define a cell value factory for a column. This factory will extract the item for the column from a data item of the table. The CellDataFeatures that is passed to the lambda expression contains the data item for the current row that is defined by TableView.getItems(). In your example you always return the value (the complete data item). Therefore each cell contains the data item that is defined for the row.


[Mastering JavaFX 8 Controls]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trying to populate data from database in tableview using javafx mvc architecture.