2014-11-20 2 views

ответ

2

Ваша кнопка должна выглядеть так:

<p:commandLink oncomplete="confirmation.show()" 
    action="#{campagneComtroller.messageDeleteCam1(c)}" 
    update=":frmDlgDel:confirmDialog"> 
    <p:graphicImage value="/image/delete.png" height="20" width="20"/> 
</p:commandLink> 

Ваш confirmDialog должно быть так:

<h:form id="frmDlgDel"> 
      <p:confirmDialog id="confirmDialog" 
        message="#{campagneComtroller.messageDeleteCam1}" 
         header="#{bundles.messages['message.SupprimerGeneral']}" severity="alert" widgetVar="confirmation"> 
       <p:commandButton id="confirm" value="#{bundles.messages['message.OuiSure']}" oncomplete="confirmation.hide()" update=":formCam :frmDlgDel" 
         actionListener="#{campagneComtroller.deleteCam1()}" /> 
       <p:commandButton id="decline" value="NonPasEncore" onclick="confirmation.hide()" type="button" /> 
      </p:confirmDialog> 
     </h:form> 

Ваш Java код должен выглядеть так:

public void messageDeleteCam1(Cam cam) { 
conditionVerified = true; // ... you can put here your treatments 
      if (conditionVerified) { 
       messageDeleteCam1 = "this cam is bla bla bla "; 
      } else { 
       messageDeleteCam1 = "are you sure to delete this cam ?"; 
      } 
     } 

NB : мы использовали здесь oncomplete + update, поэтому мы смогли увидеть разницу в подтвержденииDialog после обработки Java.

Смежные вопросы