I'd like to know the best & most efficient way to get JavaFX TableView data to a collection. I want to get all rows inside a JavaFX TableView.
Asked
Active
Viewed 3,345 times
0
-
1Welcome to Stack Overflow, Evin! Don't be too discouraged by downvotes. Upvotes and downvotes are part of our system to determine the usefulness of a question for future users. Because this answer is easily found in the documentation for TableView, the question received some downvotes since Java's official documentation would be a better place for future users to find the answer than stackoverflow would. – MMAdams Oct 25 '18 at 13:18
-
1There are actually two questions being asked: - the "`TableView` data to a collection." and - "I want to get all rows inside a JavaFX `TableView`.", probably referring to actual `TableRow` instances. `getItems()` only answers the first question since it returns the actual data model, not the `TableRow`s. For the second question all I could find on a quickish search was [here, using `tableView.lookupAll(".table-row-cell");`](https://www.programcreek.com/java-api-examples/?api=javafx.scene.control.TableCell). However that call returned an empty list when I tested it locally. Right now I have tro – TudoGeorge Feb 27 '19 at 13:10
1 Answers
5
There is a getItems()
call you can make to get the contents of a TableView
. It returns an ObservableList
which is a type of Collection
.

MMAdams
- 1,508
- 15
- 29