我在jsf页面上定义了一个弹出面板(id = PanelAddQueryCriteria),但它只在用户选择一个菜单项(id = entityKind)并重新渲染该popupPanel后才启用它。但是由于重新渲染,选择项(id = queryCriteriaAttr)在弹出面板中不会在第一次更改值时触发更改侦听器(#{ceaDBBean.queryCriteriaAttrChanged}),并且仅在再次选择时触发...任何帮助?代码如下:
<rich:popupPanel id="PanelAddQueryCriteria">
<h:form id="formAddQueryCriteria">
<h:selectOneMenu id="queryCriteriaAttr"
value="#{ceaDBBean.queryCriteriaAttr}" required="true"
valueChangeListener="#{ceaDBBean.queryCriteriaAttrChanged}">
<f:selectItems value="#{ceaDBBean.ceaEntityKindAttrs}"/>
</h:selectOneMenu>
</h:form>
</rich:popupPanel>
<h:panelGrid id="searchPanel">
<h:selectOneMenu id="entityKind"
value="#{ceaDBBean.entityKind}" required="true"
valueChangeListener="#{ceaDBBean.entityKindChanged}">
<a4j:ajax event="valueChange" render="addQueryCriteria" execute="@this" />
<f:selectItems value="#{ceaDBBean.ceaEntityKinds}" />
</h:selectOneMenu>
<a4j:commandLink styleClass="no-decor" id="addQueryCriteria"
render="PanelAddQueryCriteria"
disabled="#{empty ceaDBBean.entityKind}"
execute="@this" action="#{ceaDBBean.initAddQuryCriteria}"
oncomplete="#{rich:component('PanelAddQueryCriteria')}.show()">
<h:graphicImage id="addQueryCriteriaImg"
value="/images/icons/common/new.gif" width="16" height="16"
alt="#{adminMsg.addQueryCriteria}" />
<rich:tooltip value="#{adminMsg.addQueryCriteria}" for="addQueryCriteria" />
</a4j:commandLink>
</h:panelGrid>
答案 0 :(得分:0)
简短回答:此问题是由JSF issue 790引起的。变化
render="PanelAddQueryCriteria"
通过
render="formAddQueryCriteria"
或者,如果您在面板中实际需要更新而不是表单本身,
render="PanelAddQueryCriteria formAddQueryCriteria"
答案很长:阅读以下相关问题: