I have a TableView in one of the Tabs of a TabPane. I want to add a click event on the cell, user id , so that when ever the user clicks on a particular user id , i open a new tab with user specific details. how to add event listeners to all the cells in a column ?
<TableView fx:controller="tableViewController"
fx:id="tableViewTable" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8">
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
<columns>
<TableColumn text="First Name">
<cellValueFactory>
<PropertyValueFactory property="firstName" />
</cellValueFactory>
</TableColumn>
<TableColumn text="Last Name">
<cellValueFactory>
<PropertyValueFactory property="lastName" />
</cellValueFactory>
</TableColumn>
<TableColumn text="User Id">
<cellValueFactory>
<PropertyValueFactory property="userId" />
</cellValueFactory>
</TableColumn>
</columns>
</TableView>
This blog http://java-buddy.blogspot.com/2013/05/detect-mouse-click-on-javafx-tableview.html talks about capturing the click event programmatically, how do I do something similar when using FXML ?