probleme avec la methode getRowData()
Bonjour tout le monde, j'ai un problème de récupération de lignes avec la méthode, j'utilise un <rich:datatable> pour afficher les enregistrements, j'ai utilisé un bouton dans chaque ligne pour récupérer les détails sur chaque enregistrement dans un <rich:modalPanel>.le problème est quand je clique sur le bouton détails je récupère a chaque fois le premier enregistrement du datatable.
le code que j'utilise pour ma page jsf est comme suit:
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
<rich:dataTable value="#{commercantBean.dataModel}" var="cmr"
rowClasses="row1, row2" id="table" rows="10"
columnClasses="50,100,100,100"
onRowMouseOver="this.style.backgroundColor='#B5F3FB'"
onRowMouseOut="this.style.backgroundColor='#{a4jSkin.rowBackgroundColor}'"
width="350" >
<f:facet name="header">
<h:outputText value="Commerçant" />
</f:facet>
<rich:column >
<f:facet name="header">
<h:outputText value="#{msgs.IDCOMMERCANT}" />
</f:facet>
<h:outputText value="#{cmr.id_Commercant}" />
</rich:column>
...
<h:column>
<f:facet name="header">
<h:outputText value="#{msgs.DETAILS}"/>
</f:facet>
<a4j:commandButton action="#{commercantBean.Details}"
oncomplete="javascript:Richfaces.showModalPanel('panel');" value="#{msgs.DETAILS}"/>
<rich:modalPanel id="panel" autosized="false" keepVisualState="false" width="350" height="350">
<f:facet name="header">
<h:outputText value="Selected Rows"/>
</f:facet>
<f:facet name="controls">
<span style="cursor:pointer" onClick="javascript:Richfaces.hideModalPanel('panel')">X</span>
</f:facet>
<h:panelGroup layout="block" styleClass="scrolls">
<center>
<table width="432" border="0">
<tr>
<td width="195"><h:outputText value="#{msgs.LASTNAMECOMMERCANT}" /></td>
<td width="373"><div align="center">
<h:outputText id="name_cmr" value="#{commercantBean.cmr.last_name}" />
</div></td>
<td width="373"></td>
</tr>
....
<tr>
<td><h:outputText value="#{msgs.LABEL_ZIPCODE}" /></td>
<td><div align="center">
<h:outputText id="zip" value="#{commercantBean.cmr.zip_code}" />
</div></td>
<td><h:message for="zip" styleClass="errMsg"/></td>
</tr>
</table>
</center>
</h:panelGroup>
</rich:modalPanel> |
et pour le code que je mets dans le managed bean pour la méthode détails est comme suit:
Code:
1 2 3 4 5
|
public String Details(){
this.cmr=(Commercant) DataModel.getRowData();
return null;
} |
dans l'attente de aide, merci davance