【问题标题】:Conditionally display a richfaces modal panel有条件地显示 Richfaces 模态面板
【发布时间】:2010-04-30 18:12:24
【问题描述】:
很简单:
<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
【问题讨论】:
标签:
richfaces
modal-dialog
【解决方案2】:
你可以用这个:
<a4j:commandButton data="#{ordre.render}"
oncomplete=" if (data == true) {
#{rich:component('popup')}.show()
} else {
alert('error');
}" />
【解决方案3】:
使用这个:
<a4j:commandButton value="verify"
oncomplete="#{rich:component('popup')}.show()" >
<a4j:support event="onclick"
onsubmit="if (!verifInputs()){return false;}"/>
</a4j:commandButton>
【解决方案4】:
由于该条件仅在 backing be 中可用,因此您应该使用此:
<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>
【解决方案5】:
oncomplete="if (#{ MyBacking.myCondition}) {
#{
rich:component('myModelPanel'
}.show()
}"