2010-04-30 3 views
5

assez simple:afficher conditionnellement un panneau modal richfaces

<a4j:commandButton id="bob" 
     action="#{MyBacking.doAction}" 
     image="/img/btn.png" 
     reRender="stuff" 
       oncomplete="#{not empty MyBacking.myCondition ? #{rich:component('myModelPanel')}.show()" : <do nothing>}" 
     ajaxSingle="true"> 
    </a4j:commandButton> 

EL Cest évidemment pas valide. Quelle est la méthode la plus concise que je montre conditionnellement myModelPanel de cette manière?

Merci IA

Répondre

1

Essayez d'appeler la méthode vide JS

1

Vous pouvez utiliser ceci:

<a4j:commandButton data="#{ordre.render}" 
        oncomplete=" if (data == true) { 
            #{rich:component('popup')}.show() 
           } else { 
            alert('error'); 
           }" /> 
0

utiliser ceci:

    <a4j:commandButton value="verify" 
             oncomplete="#{rich:component('popup')}.show()" > 
         <a4j:support event="onclick" 
            onsubmit="if (!verifInputs()){return false;}"/> 
        </a4j:commandButton> 
0

La condition est uniquement disponible dans le support été vous devriez utiliser ceci:

<a4j:commandButton id="bob" 
     action="#{MyBacking.doAction}" 
     image="/img/btn.png" 
     reRender="stuff" 
       oncomplete="if (#{not empty MyBacking.myCondition} == true) { 
           #{rich:component('myModelPanel')}.show() 
          }" 
     ajaxSingle="true"> 
</a4j:commandButton> 
0
oncomplete="if (#{ MyBacking.myCondition}) { 
#{ 
rich:component('myModelPanel' 
}.show() 
}" 
Questions connexes