【问题标题】:ConfirmationDialog Primefaces确认对话框 Primefaces
【发布时间】:2023-04-03 10:41:02
【问题描述】:

..现在我遇到一个问题。

<tabview>
<tab>...
</tab>
<tab>...
</tab>
<tab>...
</tab>
<tab id="p">
    <h:form id="qorm">
        <h:panelGroup >
            <p:commandButton value="Save"  actionListener="#{...}" update="priorityDataTable" />
            <p:commandButton id="cancelButton" value="Cancel"
onclick="confirmation.show()"   type="button" />
        </h:panelGroup>
        <p:dataTable id="priorityDataTable"
        styleClass="priorityDataTable"
            selection="#{...selectedJobQueue}"
            rowSelectListener="#{...onRowSelect}"
            selectionMode="single"
            value="#{....priorityList}" var="priority"
            >
            <p:column>
                <f:facet name="header"> 
                        Request<br />Number
                    </f:facet>
                <h:outputText value="#{priority.reworkRequest.requestNumber}" />
            </p:column>
            <p:column>
                <f:facet name="header"> 
                        #
                    </f:facet>
                <h:outputText value="#" />
            </p:column>
            <p:column>
                <f:facet name="header"> 
                        Status
                    </f:facet>
                <h:outputText value="#{priority.priorityStatus.getTextValue()}" />
            </p:column>

        </p:dataTable>
        <h:panelGroup class="queuePriorityActionButton">
            <p:commandButton id="moveUpButton" value="Move Up" actionListener="#{....moveUp()}" />
            <p:commandButton id="moveDownButton" value="Move Down" actionListener="#{....moveDown()}"  />
        </h:panelGroup>

        </h:form>
        <h:form>

        <p:confirmDialog message="All updates since your last save will be lost.  Are you sure you want to exit?" modal="true"
        header="Initiating destroy process" severity="alert" widgetVar="confirmation">      
            <p:commandButton value="Yes Sure" update="queuePriorityForm:priorityDataTable "  oncomplete="confirmation.hide()"
        actionListener="{....resetBack()}"  />
            <p:commandButton value="Not Yet" onclick="confirmation.hide()" type="button" /> 

        </p:confirmDialog>
        </h:form>
</tab>
</tabview>

当用户更改表的优先级,并且用户移动请求然后选择另一个选项卡而不保存请求时。必须显示一个确认对话框。 所以我不知道该怎么做。任何人都可以帮助我

【问题讨论】:

    标签: jquery dialog primefaces


    【解决方案1】:

    有什么理由不使用 window.confirm() ? (见http://www.w3schools.com/js/js_popup.asp

    【讨论】:

    • 最好使用 ConfirmationDialog 。我们要保持风格一致
    • 您还有其他解决方案吗?
    • 不抱歉,我只是写了这个,因为当我阅读您的代码时,这对我来说似乎很明显,但我不知道 Primefaces...我很抱歉 ;)
    猜你喜欢
    • 2014-04-08
    • 2017-09-07
    • 2019-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多