2011-05-18 50 views
0

..现在我遇到了一个问题。ConfirmationDialog Primefaces

<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> 

当用户改变表的优先级,以及用户移动的请求(多个),然后,不保存request.Must显示confirmationDialog选择另一个选项卡。 所以我不知道该怎么做。AnyOne可以帮助我

回答

0

你为什么不使用window.confirm()? (请参阅http://www.w3schools.com/js/js_popup.asp

+0

最好使用ConfirmationDialog。我们希望保持一致的样式 – FishGel 2011-05-18 10:35:43

+0

您是否有其他解决方案? – FishGel 2011-05-18 11:01:27

+0

没有抱歉,我只是写了这个,因为当我阅读你的代码时,它似乎很明显,但我不知道Primefaces ...我的歉意;) – 2011-05-18 12:03:12