I am using Primefaces 3.0 with JSF 2.0. I have a datatabl开发者_如何学运维e with expansion enabled. I wanted to call a bean method when the user clicks on rowToggler. Basically I wanted to load the expansion details only when the user clicks the expand button. I can't see a server side callback for row expansion in the documentation. Please let me know if I can have any workaround for this problem.
Thanks and Regards, Renju
Following the link Howard provided in the question comment I could see that this was implemented in PF 3.4:
XHTML
<p:ajax event="rowToggle" listener="#{tableBean.onRowToggle}" update=":form:growl" />
Bean
public void onRowToggle(ToggleEvent event) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO,
"Row State " + event.getVisibility(),
"Model:" + ((Car) event.getData()).getModel());
FacesContext.getCurrentInstance().addMessage(null, msg);
}
You can see this in the showcase: https://www.primefaces.org/showcase/ui/data/datatable/expansion.xhtml
Primefaces' rowToggler already loads content with ajax so you should be fine ;-)
From the manual:
p:rowToggler component places an expand/collapse icon, clicking on a collapsed row loads expanded content with ajax.
精彩评论