Bonjour a tous;
mon probléme c'est de recuperer la valeur d'un item selectionné a partir d'un Datatable primefaces. j'ai ajouter un bouton qui récupérer cet item et le faite de cliquer sur ce bouton il y a quelques opérations a faire sur l'objet sélectionné.
le code .xhtml:
le code de bean:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 <p:dataTable var="rec" value="#{recBean.listRec}" rowKey="#{rec.idTypeRec}" selection="#{recBean.selectRec}" converter="#{genericSecuredConverter}"> <p:column headerText="Type Reclamation" sortBy="#{rec.idTypeRec}"> <h:outputText value=" #{rec.idTypeRec}"/> </p:column> <p:column headerText="Abonnement" sortBy="#{rec.idAbonnement}"> <h:outputText value=" #{rec.idAbonnement}"/> </p:column> <p:column headerText="Date" sortBy="#{rec.date}"> <h:outputText value=" #{rec.date}"/> </p:column> <p:column style="width:40px"> <h:panelGrid columns="3" styleClass="actions" cellpadding="2"> <p:commandButton id="Button" actionListener="#{recBean.detailsRec}" icon="ui-icon-search" title="details"> <f:setPropertyActionListener value="#{rec}" target="#{recBean.selectRec}" /> </p:commandButton> </h:panelGrid> </p:column> </p:dataTable>
merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 public void detailsRec(){ abonnement=abonService.findById(selectRec.getIdAbonnement()); reclamation=reclamationService.findRecByIDtype(selectRec.getIdTypeRec()); System.out.print(abonnement.getLibelleType()); System.out.print(reclamation.getLibelleTypeRec()); }
Partager