primefaces更新属性不适用于从模态对话框打开的模态对话框

时间:2015-10-28 12:55:27

标签: jsf primefaces dialog

我有一个列表(p:dataTable)元素。如果我选择一个元素,它的详细信息会显示在p:dialog上。细节呈现另一种列表,另一种元素。如果我从该列表中选择一个元素,则会打开另一个p:dialog及其详细信息。

现在,我可以编辑这些详细信息并更新条目,但update参数不起作用。列表不会重新呈现。我必须关闭对话框并再次打开它。

我还必须使用一个奇怪的onkeyup来更新类newEventCommentClass的每个textarea。否则,#{event.comment}将填充空字符串而不是p:inputTextarea值。

我尝试了各种组合:

  • update="@all"关闭所有对话框。
  • update="@form"update="@form:issueEvents" update="@this :issueDetail"update="@this @(.issueEventsClass)"update="@this :issueEvents"等组合不执行任何操作。

当我直接打开内部对话框而不是从另一个对话框打开时,使用update=":elementId"方法重新呈现列表没有任何问题。

当详细信息对话框从另一个列表的父详细信息对话框打开时,如何使其工作?

这是我正在使用的“外部”对话框代码:

<p:dialog 
    closeOnEscape="true"  
    widgetVar="commissionDetail" 
    id="commissionDetail" 
    modal="true" 
    width="60%"
>   
    <ui:include src="/views/widgets/commission_detail_edit.xhtml" />
</p:dialog>

这是“内部”对话框代码(注意我必须使用appendTo="@(body)",否则它会在父对话框设置的模态锁内打开):

<p:dialog 
        closeOnEscape="true" 
        widgetVar="issueDetail" 
        id="issueDetail" 
        modal="true" 
        appendTo="@(body)" 
>   
        <p:ajax event="close" update=":manageCommissionSession:commissionSessionIssues" />
        <ui:include src="/views/widgets/issue_detail_edit.xhtml" />
</p:dialog>

这是“外部”对话框内容commission_detail_edit.xhtml

<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
>
    <h:form id="manageCommissionSession" prependId="false">
            <p:dataTable 
                id="commissionSessionIssues"
                value="#{myCommissionsController.selectedCommissionSession.issues}"
                var="tissue" 
                selection="#{issue}"
                selectionMode="single" 
                rowKey="#{tissue.idIssue}"
            >
                <p:ajax event="rowSelect" listener="#{myIssuesController.onSelectOneRow}" update=":issueDetail" oncomplete="PF('issueDetail').show();"/>
                <p:column headerText="#{i18n['issue.title']}">
                    <h:outputText value="#{tissue.title}" />
                </p:column>
                <p:column headerText="#{i18n['issue.description']}">
                    <h:outputText value="#{tissue.description}" />
                </p:column>
            </p:dataTable>
    </h:form>
    <p:dialog 
        // ... (the dialog code shown above)
    </p:dialog>
</ui:composition>

这是“内部”对话框内容issue_detail_edit.xhtml

<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
>
    <h:form id="manageIssue" styleClass="manageIssueClass" prependId="false">
        <p:commandButton 
            id="saveNewEventButton" 
            value="#{i18n.saveEvent}" 
            action="#{newIssueController.addIssueEvent}" 
            process="@this @(.newEventCommentClass)" 
            update="@this @(.issueEventsClass)"
        />
        <br />
        <p:inputTextarea 
            id="newEventComment" 
            styleClass="newEventCommentClass" 
            value="#{event.comment}" 
            onkeyup="$('.newEventCommentClass').val($(this).val())"
        />
        <p:dataTable 
            id="issueEvents"
            styleClass="issueEventsClass"
            value="#{myIssuesController.selectedIssue.events}"
            var="tevent"
        >
            <p:column headerText="#{i18n['date']}">
                <h:outputText value="#{tevent.eventDate}" />
            </p:column>
            <p:column headerText="#{i18n['comment']}">
                <h:outputText value="#{tevent.comment}" />
            </p:column>
        </p:dataTable>
    </h:form>
</ui:composition>

0 个答案:

没有答案
相关问题