有条件地显示richfaces模式面板

时间:2010-04-30 18:12:24

标签: richfaces modal-dialog

非常简单:

    <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。我有条件地以这种方式显示myModelPanel的最简洁方法是什么?

感谢IA

5 个答案:

答案 0 :(得分:1)

尝试调用空JS方法

答案 1 :(得分:1)

您可以使用:

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

答案 2 :(得分:0)

使用它:

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

答案 3 :(得分:0)

由于条件仅在备份中可用,您应该使用此:

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

答案 4 :(得分:0)

oncomplete="if (#{ MyBacking.myCondition}) {
#{
rich:component('myModelPanel'
}.show()
}"