Problème récupération de donnée dans une ligne de DataTable
Bonjour,
alors voici mon probleme. En fait j'ai un dataTable qui contient une liste d'articles. Dans chaque ligne de ce DataTable j'ai ajouter un commandLink qui me permet d'ajouter cet article a mon panier. Jusque la pas de soucis. Le probleme c'est quand je souhaite definir une quantite de cet article a ajouter a mon panier. Donc dans la meme case que mon lien je mets un champ quantiteTmp (de mon article). Le truc c'est que quand je clique sur le lien, il ne récupère jamais ce champ, il me dit qu'il est a null. Je comprends pas d'ou vient le probleme ...
Voici le code correspondant
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
| <rich:dataTable rendered="#{not empty ArticleBean.articles}"
value="#{ArticleBean.articles}" var="article"
id="articleMarbrerieTable">
<f:facet name="header">
<rich:columnGroup>
<rich:column>
<h:outputText value="#{msg.actions}" />
</rich:column>
<rich:column>
</rich:column>
<rich:column>
<h:outputText value="#{msg.libelle}" />
</rich:column>
<rich:column>
<h:outputText value="#{msg.reference}" />
</rich:column>
<rich:column
rendered="#{TransactionBean.transactionAchatEnCours}">
<h:outputText value="#{msg.panier}" />
</rich:column>
</rich:columnGroup>
</f:facet>
<rich:column rendered="#{article.famille == 'articleMarbrerie'}">
<a4j:region>
<h:panelGrid columns="2" style="text-align:center;">
<a4j:commandLink reRender="formArticle"
action="#{ArticleBean.editArticle}">
<h:graphicImage width="15" height="15" style="border: none"
value="img/edit.png" alt="Editer" title="Editer" />
<f:param name="idArticle" value="#{article.id}" />
</a4j:commandLink>
<a4j:commandLink reRender="formArticle, dropPanel"
action="#{ArticleBean.deleteArticle}">
<h:graphicImage width="15" height="15" style="border: none"
value="img/supprimer.png" alt="Supprimer" title="Supprimer" />
<f:param name="idArticle" value="#{article.id}" />
<f:param name="fromArticleList" value="fromArticleList" />
</a4j:commandLink>
</h:panelGrid>
</a4j:region>
</rich:column>
<rich:column rendered="#{article.famille == 'articleMarbrerie'}">
<a4j:outputPanel layout="block" style="cursor: pointer">
<rich:dragSupport
rendered="#{TransactionBean.transactionAchatEnCours}"
dragIndicator="indicator" dragType="article"
dragValue="#{article}">
<rich:dndParam name="label" value="#{article.libelle}" />
</rich:dragSupport>
<h:graphicImage value="#{article.emplacementImage}" width="50"
height="50" />
<rich:toolTip followMouse="true" showDelay="5000"
style="background:#FFFFFF;border-color:#1E90FF; border:1;"
direction="bottom-right" mode="ajax">
<h:graphicImage value="#{article.emplacementImage}"
width="250" height="250" />
</rich:toolTip>
</a4j:outputPanel>
</rich:column>
<rich:column rendered="#{article.famille == 'articleMarbrerie'}">
<a4j:outputPanel layout="block" style="cursor: pointer">
<rich:dragSupport
rendered="#{TransactionBean.transactionAchatEnCours}"
dragIndicator="indicator" dragType="article"
dragValue="#{article}">
<rich:dndParam name="label" value="#{article.libelle}" />
</rich:dragSupport>
<h:outputText value="#{article.libelle}" />
</a4j:outputPanel>
</rich:column>
<rich:column rendered="#{article.famille == 'articleMarbrerie'}">
<a4j:outputPanel layout="block" style="cursor: pointer">
<rich:dragSupport
rendered="#{TransactionBean.transactionAchatEnCours}"
dragIndicator="indicator" dragType="article"
dragValue="#{article}">
<rich:dndParam name="label" value="#{article.libelle}" />
</rich:dragSupport>
<h:outputText value="#{article.reference}" />
</a4j:outputPanel>
</rich:column>
<rich:column
rendered="#{TransactionBean.transactionAchatEnCours and article.famille == 'articleMarbrerie'}">
<h:panelGrid columns="1">
<h:panelGrid columns="2">
<h:outputText value="#{msg.quantite }" />
<rich:inputNumberSpinner immediate="true" inputSize="3" value="#{article.quantiteTmp}" />
</h:panelGrid>
<h:commandLink action="#{ArticleBean.addArticleToPanier}">
<h:outputText value="#{msg.addArticleToPanier }" />
<f:param name="idArticle" value="#{article.id}" />
<a4j:support event="onclick" reRender="dropPanel" />
</h:commandLink>
</h:panelGrid>
</rich:column>
</rich:dataTable> |
Je vous ai mis tout mon dataTable mais seule la dernière colonne est intéressante. C'est dans la methode addArticleToPanier que je teste la valeur de quantiteTmp...qui est toujours nulle !
Merci d'avance pour vos réponses