2015-07-16 3 views
0

В настоящее время я интегрирую p: confirmDialog в наши пользовательские компоненты/jsf ui. Но при использовании р: confirmDialog в этой иерархии она не удалась:Подлинности confirmDialog не отображается внутри p: tabView

p:panel 
    p:tabView 
     p:tab 
      h:form 
       p:panel 
        h:panelGroup 
         h:panelGroup 
          p:commandButton 
          p:confirmDialog 

В других формах это удалось:

h:form  
    p:panel 
     h:panelGroup 
      h:panelGroup 
       p:commandButton 
       p:confirmDialog     
     p:panel 
      p:tabView 
       p:tab 

Обратите внимание, один из наиболее очевидной разницы, где часа: определяются форма и confirmDialog находится внутри tabView (не удалось).

Вот как я определил confirmDialog:

<p:commandButton id="saveButtonWithMessage" 
      rendered="#{cc.attrs.edit and !empty(cc.attrs.backingBean.objectId) and !empty(cc.attrs.updateConfirmationMessage)}" 
      value="#{messages['action.save']}" icon="ui-icon-check" 
      onclick="PF('saveButtonWithMessageDialog').show();"> 
</p:commandButton> 

<p:confirmDialog message="#{cc.attrs.updateConfirmationMessage}" 
    widgetVar="saveButtonWithMessageDialog" showEffect="fade" 
    hideEffect="fade"> 
    <p:commandButton ajax="#{cc.attrs.ajaxSubmit}" 
     value="#{messages['commons.yes']}" styleClass="ui-confirmdialog-yes" 
     icon="ui-icon-check" oncomplete="saveButtonWithMessageDialog.hide()" 
     action="#{cc.attrs.backingBean.saveOrUpdate(cc.attrs.killConversationOnSave)}"> 
     <f:param name="edit" value="#{cc.attrs.edit}" /> 
    </p:commandButton> 
    <p:commandButton value="#{messages['commons.no']}" type="button" 
     styleClass="ui-confirmdialog-no" icon="ui-icon-close" 
     onclick="PF('saveButtonWithMessageDialog').hide()" /> 
</p:confirmDialog> 

На втором примере, браузер успешно отправлен запрос и получил ответ, но он застрял с экраном серого модальным.

Вот частичный ответ я получил:

<partial-response> 
    <changes> 
     <update id="tabView:j_idt625"><div id="tabView:j_idt625" class="ui-messages ui-widget" aria-live="polite"></div></update> 
     <update id="tabView:j_idt680"><div id="tabView:j_idt680" class="ui-messages ui-widget" aria-live="polite"></div></update> 
     <update id="tabView:j_idt732"><div id="tabView:j_idt732" class="ui-messages ui-widget" aria-live="polite"></div></update> 
     <update id="tabView:j_idt788"><div id="tabView:j_idt788" class="ui-messages ui-widget" aria-live="polite"></div></update> 
     <update id="javax.faces.ViewState">3685613370368244617:-6252032147041871407</update> 
    </changes> 
</partial-response> 

Любая идея?

ответ

0

Вот как я решил свою проблему, заметьте, что все кнопки основаны на ajax. Чтобы перейти с подтверждения на Dialog на другую страницу, мне нужно создать кнопку, которая запускает remoteCommand, remoteCommand вызывает действие backingBean, которое возвращает навигацию по строкам, определенную в faces-config.xml.

<!-- Update with message --> 
<p:remoteCommand id="remoteUpdateWithMessageButton" 
    action="#{backingBean.action}" 
    name="updateWithMessage" oncomplete="handleUpdateWithMessageComplete(xhr,status,args)" /> 
<p:commandButton id="saveButtonWithMessage" 
    rendered="#{trueOrFalse}" 
    value="Save" icon="ui-icon-check" 
    oncomplete="PF('saveButtonWithMessageDialog').show()"> 
</p:commandButton> 
<!-- Update the message handling when --> 
<p:confirmDialog id="confirmUpdateWithMessage" appendTo="@(body)" 
    widgetVar="saveButtonWithMessageDialog" showEffect="fade" 
    hideEffect="fade" severity="alert" 
    message="#{(cc.attrs.updateConfirmationMessage eq '') ? messages['confirmationMessage.confirmUpdate'] : cc.attrs.updateConfirmationMessage}"> 
    <p:commandButton id="updateOk" value="yes" 
     styleClass="ui-confirmdialog-yes" icon="ui-icon-check" 
     oncomplete="updateWithMessage()" 
     onclick="PF('saveButtonWithMessageDialog').hide()"> 
    </p:commandButton> 
    <p:commandButton id="updateKO" value="#{messages['commons.no']}" 
     type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" 
     onclick="PF('saveButtonWithMessageDialog').hide()" /> 
</p:confirmDialog> 
<!-- Update with message --> 

<script type="text/javascript"> 
//<![CDATA[ 
    function handleUpdateWithMessageComplete(xhr, status, args) { 
     var result = args.result; 
     if(typeof(result)!="undefined" && !result){ 
      PF('confirmCannotUpdateWithMessageDialog').show(); 
     } 
    } 
//]]> 
</script>