May 2015
Beginner to intermediate
412 pages
8h 44m
English
There are several ways to select a row or multiple rows, such as line selection and selection with radio buttons and checkboxes, from the dataTable component. We will cover all the possibilities in this recipe.
To make a single selection possible with a command component, such as commandLink or commandButton, f:setPropertyActionListener can be used to set the selected row as a parameter to the server side:
<p:dataTable id="withCommand" var="car"
value="#{dataTableBean.cars}"
selection="#{dataTableBean.selectedCar}"> <p:column> <p:commandButton value="Select" update=":mainForm:display" oncomplete="carDialog.show()"> <f:setPropertyActionListener value="#{car}" target="#{dataTableBean.selectedCar}" /> </p:commandButton> ...Read now
Unlock full access