P:commandLink and p:dataTable issue

UI Components for JSF
Post Reply
zoomzorro
Posts: 14
Joined: 14 Mar 2011, 08:29

17 Nov 2011, 06:06

Here is the stack I'm using:
PrimeFaces 3.0.M3
JBoss 6.0
JSF 2.1.0-FCS (mojarra)
Facelets 1.1.15

Issue: When p:commandLink is used with p:dataTable or h:dataTable, it passes different object (next one in the array) to the action method than the one needs to be passed.

What I observed is that, when commandLink is clicked it renders the infoList of the dataTable before passing the object to the callback method and hence next incremented object gets passed to the callback method instead of the desired one.

Here is the code snippet, to explain it further.

Here is index.xhtml:

<h:form>
<h:dataTable id="tableId" var="info" value="#{infoList}" rows="1">
<p:commandLink action="#{infoBB.viewInformation(info)}" immediate="true">
<h:outputText value="#{info.infoTitle}">
</p>
</h:dataTable>
</h:form>

Now, if I have info object id as 16 and click the link, the viewPage when it gets displayed shows information for id 17 and not 16.

viewPage.xhtml code snippet:

<h:panelGrid columnClasses="outputCol,inputCol" columns="2">
<h:outputText value="#{messages.description}"/>
<h:outputText value="#{infoBB.info.description}"/>
</h:panelGrid>

Here, infoBB is SessionScoped bean.

Can someone help resolve this issue, how do we set the object in the backing bean before even rendering begins. Any suggestions to circumvent this problem will be greatly appreciated.

Thanks,
Sundeep
EJB 3.0, JBoss 7.1.1.Final, Java EE 6, PrimeFaces 3.4.1, Mojarra 2.1.0-FCS (JSF 2.1), facelets-1.1.15

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests