【问题标题】:primefaces dialog not showing upprimefaces 对话框未显示
【发布时间】:2013-06-28 09:16:22
【问题描述】:

大家好,primefaces 的对话框不再显示。这是我的代码。请帮忙,我是不是做错了什么。 这是我从标题为“更多”的列中调用对话框的代码:

    <h:panelGrid columns="2">
    <p:dataTable id="tbl" var="holder">
    ...
    <p:column>  
                    <f:facet name="header">  
                        <h:outputText value="More"/>  
                    </f:facet>  
                    <p:commandLink value="more" type="button" styleClass="ui-icon ui-icon-search" actionListener="#{editCustomerView.viewCustomerInfo}" update=":content_form:customerInfoDialog" oncomplete="_cusInfoDlg.show()">
                        <f:attribute name="currentCustomer" value="#{holder}"/>
                    </p:commandLink>
    </p:column>
    ...
    </p:dataTable>
    </h:panelGrid>

//dialog is here

    <p:dialog id="customerInfoDialog" widgetVar="_cusInfoDlg" header="Зээлдэгчийн мэдээлэл">
            <ui:include src="#{editCustomerView.infoPage}.xhtml"/>
            <h:commandButton value="ok" styleClass="btn" style="width: 100px; float: right; margin-right: 20px; margin-bottom: 20px;" onclick="customerInfoDlg.hide(); return false;"/>
    </p:dialog>

这里是支持 bean actionListener 方法

public void viewCustomerInfo(ActionEvent event)
{   
    this.currentCustomer = (Customer) event.getComponent().getAttributes().get("currentCustomer");
    this.currentCustomerAddress = prepareCurrentCustomerAddress(this.currentCustomer);

    if(this.currentCustomer.isIsCitizen()){ 

        this.infoPage = "CitizenInfo";


    }
    else
    {
        this.infoPage = "OrganizationInfo";
    }
}

【问题讨论】:

  • 我通过在对话框中添加 dynamic = 'true' 来解决它。但是为什么会这样解决呢?
  • 如果您从&lt;p:commandLink 中删除type="button",您将能够从您的对话框中删除dynamic = 'true',对吗?
  • 您是否已从旧版本迁移到新版本?

标签: jsf-2 primefaces dialog


【解决方案1】:

我通常通过 Javascript 打开对话框

    PF('_cusInfoDlg').show();

【讨论】:

  • 请说明为什么要这样做,因为在 OP 的示例中,它也是通过 javascript 在 oncomplete 中打开的!!!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-11-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多