Hi,
I have a requirement where I am displaying employee data in a jsf page (employee.xhtml) using <p:dataTable>
I display Emp Id, Emp Name fileds using <p:dataTable> as below
---------------------------- employee.xhtml--------------------------------------
<h:form id="empForm" >
<p:dataTable id="empDataTable" value="#{bean1.getDetails}" var="emp"
frame="hsides" rules="all" emptyMessage="" scrollable="false" widgetVar="table">
<p:column headerText="Emp Id" style="width:15%;">
<p:commandLink value="#{emp.empId}"
actionListener="bean2.retrieveParams"
update="dialogPanel"
oncomplete="modalDialog.show()" >
<f:param name="empId" value="#{emp.empId}" />
<f:param name="empName" value="#{emp.empName}" />
</p:commandLink>
<h:outputText value="#{emp.empId}" />
</p:column>
<p:column headerText="Emp Name" style="width:15%;">
<h:outputText value="#{emp.empName}" />
</p:column>
</p:dataTable>
<p:panel id="dialogPanel">
<p:dialog id="modalDialog" styleClass="dialogBoxOverlay" resizable="false"
header="Emp Details" width="950" height="550"
widgetVar="modalDialog" modal="true" draggable="false">
<ui:include src="EmployeeDetails.xhtml" >
</ui:include>
</p:dialog>
</p:panel>
</h:form>
----------------Bean2---------------------------------------------------------------
@ManagedBean
@ViewScoped
public class Bean2 {
private String empId =null ;
private String empName = null;
public String getEmpId() {return empId;}
public void setEmpId(String empId) {this.empId= empId;}
public String getEmpName() {return empName;}
public void setEmpName(String empName) {this.empName= empName;}
public void retrieveParams(){
empId = (String)FacesContext.getCurrentInstance(). getExternalContext()
.getRequestParameterMap().get("empId ");
String empName= (String)FacesContext.getCurrentInstance().
getExternalContext().getRequestParameterMap().get("empName");
}
}
---------------------------------------------------------------------------------
Now in the data table, employee id is a hyperlink. When I click this link, it should call the method assigned to "actionlistener" (Bean2.retrieveParams()). Here I will retrieve the params and store them in some variables and once the method is processed I have "oncomplete" in <p:commandLink>. "oncomplete" should call "p:dialog" (this tga is in employee.xhtml). <p:dialog> includes "employeeDetails.xhtml".
My issue is <p:dialog> does not get called. It does not load the popup.
I need to load this <p:dialog> and I should be able to access the parameters in Bean2.
How do I do ??
Regards
Anu
Primefaces Ver : 3.4
Server : JBOSS v7 with Liferay Portal
=======================================================================
I got the solution for this.
In the <p:dialog> add a <h:form> as below. I removed the tag "<p:panel id="dialogPanel">
"
<p:dialog id="modalDialog" styleClass="dialogBoxOverlay" resizable="false"
header="Emp Details" width="950" height="550"
widgetVar="modalDialog" modal="true" draggable="false">
<h:form>
<ui:include src="EmployeeDetails.xhtml" />
</h:form>
</p:dialog>
With this change I am able to retrieve the parameter in the bean2.retrieveParams() method and <p:dialog> also loads.
pass parameters to <p:dialog> after<p:commandLink> processed
-
- Information
-
Who is online
Users browsing this forum: Google [Bot] and 89 guests