Jsf p:OverlyPanel的条件显示
如何根据某些结果有条件地从@ManagedBean显示/隐藏覆盖面板。Jsf p:OverlyPanel的条件显示,jsf,primefaces,Jsf,Primefaces,如何根据某些结果有条件地从@ManagedBean显示/隐藏覆盖面板。 在下面的代码中:p:overlypanel用于p:commandButton。我想从操作方法有条件地显示覆盖面板。 现在,每当我单击commandbutton时,它都会显示出来 <h:form id="form"> <h:outputLabel value="Town Name:"/> <h:inputText value="#{myBean.town}"/> &l
在下面的代码中:
p:overlypanel
用于p:commandButton
。我想从操作方法有条件地显示覆盖面板。现在,每当我单击commandbutton时,它都会显示出来
<h:form id="form">
<h:outputLabel value="Town Name:"/>
<h:inputText value="#{myBean.town}"/>
<p:commandButton id="checkBtn" value="Check" action="#{myBean.action}"/>
<p:overlayPanel widgetVar="overL" id="over" for="checkBtn">
<h:outputText value="This town is not Listed in our records"/>
</p:overlayPanel>
</h:form>
注意:我使用的是**Primefaces 3.5**为覆盖面板提供一个小部件名称,并将showEvent设置为none(这将终止默认行为并为面板分配一个javascript句柄): 向您添加oncomplete attr按钮,类似于:
oncomplete="if(args && !args.validationFailed) myOverlay.show();"
同样的问题,添加widgetVar对我有效,但我必须做
PF('myOverlay').show()代码>
oncomplete="if(args && !args.validationFailed) myOverlay.show();"