Mustang New
Mustang New

Reputation: 81

primefaces :dialog does not show

My Problem is p:dialog is not getting displayed. Listener is getting fired, no error messages. My requirement is: when I select a row, then the row details has to be displayed in dialog.

Kindly help me out. Thanks in advance.

<h:form id="form">  
    <p:dataTable id="cars" var="car" value="#{tableBean2.carsSmall}" paginator="true"
        rows="10" rowKey="#{car.model}" selection="#{tableBean2.selectedCar}"
        selectionMode="single">  
        <p:ajax event="rowSelect" listener="#{tableBean2.onRowSelect}"    
            update=":form1:display :form1:growl" oncomplete="PF('carDialog').show()" />
        <p:ajax event="rowUnselect" listener="#{tableBean2.onRowUnselect}"
            update=":form1:growl" />
        <f:facet name="header">  
            Select a row to display a message  
        </f:facet>  
        <p:column headerText="Model">  
            #{car.model}  
        </p:column>  
        <p:column headerText="Year">  
            #{car.year}  
        </p:column>  
        <p:column headerText="Manufacturer" >  
            #{car.manufacturer}  
        </p:column>  
        <p:column headerText="Color">  
            #{car.color}  
        </p:column>
    </p:dataTable>  
</h:form>

<h:form id="form1">
    <p:growl id="growl" showDetail="true"/>  
    <p:dialog id="dialog" header="Car Detail" widgetVar="carDialog"  
        resizable="false" position="center center" height="123"
        width="456" appendToBody="true">  
        <h:panelGrid id="display" columns="2" cellpadding="4">  
          <h:outputText value="Model:" />  
          <h:outputText value="#{tableBean2.selectedCar.model}" />  
          <h:outputText value="Year:" />  
          <h:outputText value="#{tableBean2.selectedCar.year}" />  
          <h:outputText value="Manufacturer:" />  
          <h:outputText value="#{tableBean2.selectedCar.manufacturer}" />  
          <h:outputText value="Color:" />  
          <h:outputText value="#{tableBean2.selectedCar.color}" />  
       </h:panelGrid>  
    </p:dialog>  
</h:form>

Upvotes: 2

Views: 14610

Answers (1)

Andy
Andy

Reputation: 6568

I'm not entirely sure what the PF function does but when I ran your code on my end and changed

oncomplete="PF('carDialog').show()"

to

oncomplete="carDialog.show()" 

the <p:dialog> popped up.

Upvotes: 3

Related Questions