0

我在 jsf 页面顶部定义了一个弹出面板(id=PanelAddQueryCriteria),但它仅在用户选择一个菜单项(id=entityKind)并重新渲染该弹出面板后才启用它。但是,由于重新渲染,该弹出面板内的选择项(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>
4

1 回答 1

0

简短回答:这个问题是由JSF issue 790引起的。改变

render="PanelAddQueryCriteria" 

经过

render="formAddQueryCriteria" 

或者,如果您实际上需要更新的面板比表单本身更多,

render="PanelAddQueryCriteria formAddQueryCriteria" 

长答案:阅读以下相关问题:

于 2012-12-03T02:22:38.430 回答