Multi sélection ligne d'un dataTable
Bonjour ,
Je suis entrain d"utiliser le Multiple Row Selection de Primefaces et donc j'ai fait ceci :
Code:
private Candidat[] selectedCandidat;
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| <p:dataTable id="dataTableallCandidat" var="candidatref"
rendered="#{adminCtr.rendredTableauAllCandidat}" paginator="true"
rows="50" value="#{adminCtr.listcandidat}"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
emptyMessage="#{change.TableauVide}"
selection="#{adminCtr.selectedCandidat}" selectionMode="multiple"
rowKey="#{candidatref.idcandidat}">
<p:column headerText="#{change.Nom}"
filterBy="#{candidatref.nom}">
<h:outputText value="#{candidatref.nom}" />
</p:column>...
</p:dataTable>
<f:facet name="footer">
<p:commandButton value="Recommandation"
update=":consultcandidat:displayy"
oncomplete="carDialog.show()"
actionListener="#{adminCtr.recruteurRecommandCandidates}" />
</f:facet>
</p:dataTable>
<!-- / List de tous les candidats-->
<p:dialog header="Car Detail" widgetVar="carDialog" width="250"
showEffect="explode" hideEffect="explode">
<p:dataList id="displayy" value="#{adminCtr.selectedCandidat}"
var="selectedCandidat" type="definition">
Nom: #{selectedCandidat.nom}, Prenom: #{selectedCandidat.prenom}
<f:facet name="description">
</f:facet>
</p:dataList>
</p:dialog> |
Le code marche très bien et je récupère les valeurs sélectionnées dans le pou up mais ce que je voudrais c'est comment récupérer ces valeur à partir du code s'il vous plait ? :
Code:
Nom: #{selectedCandidat.nom}, Prenom: #{selectedCandidat.prenom}
au fait j'ai fait ceci :
Code:
1 2 3 4 5 6
| public void recruteurRecommandCandidates(ActionEvent actionEvent){
for(int i = 0 ;i<= selectedCandidat.length;i++){
System.out.println(selectedCandidat[i].getNom().toString());
}
} |
lorsque j'appelle la méthode j'obtiens mes valeur sélectionnées mais suivi d'une erreur
Code:
java.lang.ArrayIndexOutOfBoundsException: 3
Merci