Hi there. I'll need to get the TableRow Data (in a TableView (JavaFX)) using the index of a specific row. For exemple: there is a TableView with 3 rows and each row with 3 columns. I want to get the 3 columns of row number 2 (index of row 2 is 1). I saw in the WEB that i can get the entire row and convert it to String. Take a look below:
myTableView.setRowFactory (tv ->
{
TableRow<ObservableList> myRow =
new
TableRow<>();
theRow.setOnMouseClicked (event ->
{
if
(event.getClickCount() ==
1
&& (!myRow.isEmpty()))
{
int
myIndex =
myTableView.getSelectionModel().getSelectedIndex();
String myRowData =
myTableView.getItems().get(myIndex).toString();
}
});
return
myRow;
});
The code above run ok. I get the Index correctly. But the content of myRowData isn't correct. Can anyone help me?
Tks.