I use PrimeFaces , i want to set an action listner on the selected row to show one of his column in a dialog.
my datatable look like this:
<p:dataTable var="ligne" value="#{detailGrilleBean.lignes}">
<p:column headerText="Question">
<h:outputText value="#{ligne.questionBs}" />
</p:column>
<p:column headerText="Note">
<p:rating value="#{ligne.reponse}" readonly="true" />
</p:column>
<p:column headerText="Justification">
<p:commandLink oncomplete="nDialog.show();" title="View Detail" >
<f:setPropertyActionListener value="#{ligne}"
target="#{detailGrilleBean.selectligne}" />
<h:outputText styleClass="ui-icon ui-icon-search" style="margin:0 auto;" "/>
</p:commandLink>
</p:column>
</p:dataTable>
The dialog :
<p:dialog hideEffect="fade" width="600" height="100" id="dialogdesc" widgetVar="nDialog" modal="true" showEffect="fade" closable="true" appendToBody="true">
<p:outputPanel id="nDetail" style="text-align:center;">
<h:panelGrid columns="2" cellpadding="5">
<h:outputText id="type" value="#{detailGrilleBean.selectligne.justification}" />
</h:panelGrid>
</p:outputPanel>
</p:dialog>
The Backingbean:
@ManagedBean
@RequestScoped
public class DetailGrilleBean implements Serializable {
Grille grille;
List<Lignegrille> lignes;
Lignegrille selectligne;
//Getters & Setters
When running the dilog, it just don't show anything. I tried to put some logging in the setter and getter of the selectedligne property, but what i get is only the output log last element of the lignes;
PS: I'm using PrimeFaces 3.5 / Tomcat EE 1.6
You have to update the dialog content. Ie set update=":nDetail"
(id depends on where the dialog is placed) on the commandButton
.
Now you not call any action listner, you only put parameter. In your case you have two option: 1. Make your dataTable as selectable dataTable, example you find on primefaces home page. 2. Prepare your commandLink like this(of cource dataTable and dialog must be in form):
<p:commandLink oncomplete="nDialog.show();"
title="View Detail"
actionListener="#{detailGrilleBean.setSelectligne(ligne)}"
process="@this"
update="nDetail"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.