I have this xhtml code:
<p:dataGrid id="dgData"
columns="1"
rows="100"
value="#{myStickiesController.items}"
var="sticky">
<p:panel header="From :#{sticky.users.displayName}" rendered="#{eventstickiesController.eventSticky}" binding="#{eventstickiesController.eventPanel}">
<f:attribute name="stickyId" value="#{sticky.stickyID}" ></f:attribute>
<h:panelGrid columns="2">
<p:graphicImage value="#{imageStreamer.fileContent}" style="width:50px; height: 50px" alt="No Profile Image">
<f:param id="uid" name="uid" value="#{sticky.users.userID}" />
</p:graphicImage>
<h:outputLabel value="Event Info : #{eventstickiesController.content}" binding="#{eventstickiesController.outputLabel}">
<f:attribute name="stickyId" value="#{sticky.stickyID}" ></f:attribute>
</h:outputLabel>
</h:panelGrid>
<f:facet name="footer">
<p:commandButton image="/images/buttons/Delete.gif"
actionListener="#{myStickiesController.deleteSticky}"
action="#{snippetsStickyEditorLinkerBean.updateSnippetLink}"
update="dgData" >
<f:attribute name="stickyId" value="#{sticky.stickyID}" ></f:attribute>
开发者_开发问答 <f:param name="pageViewId" value="Default"/>
</p:commandButton>
</f:facet>
</p:panel>
</p:dataGrid>
the code of the actionListener class:
public class MyStickiesController {
public void deleteSticky(ActionEvent ae)
{
Long sid = (Long)ae.getComponent().getAttributes().get("stickyId");
Stickies s = ejbFacade.find(sid);
List<Recipients> rl = s.getRecipientsList();
DBConnectionProxyUser sbcpu = new DBConnectionProxyUser();
Users currentUser = sbcpu.getConnectedUser(ejbUsersFacade);
for (Recipients r:rl)
{
if (currentUser.getUserID()==r.getUsers().getUserID())
{
r.setDisplay(Boolean.FALSE);
}
}
}
}
Now, if I put the command button that is inside the p:dataGrid, the dataGrid is updated and the actionListener works. If I put the button inside the dataGrid, the dataGrid is not updated and the actionListener doesn't work.
I tried wrapping thw whole thing with p:outputPanel, and the actionListener doesn't work.
The ActionEvent is javax.faces.event.ActionEvent I am using Mojarra 2.1.3 with primefaces 2.2.1, Glassfish 3.0.1 and Netbeans 6.9.1
Thanks in advance...
I managed to make it work...
The solution renders into 2 parts:
I updated the Glassfish Mojarra Module to 2.1.3
I added a p:remotecommamd and a p:outputpanel to be rendered in case the inner snippet is to be rendered. Other snippets are easy to be rendered.
I hope this one helps somebody...
精彩评论