我有一个带有搜索条件的表单和一个触发搜索的commandButton:
<h:form id="search_criteria">
...
<a4j:commandButton id="commandButton" value="Search"
actionListener="#{searchBean.searchActionListener}"
render="@form, search_results_form_node,search_results_form_service" />
</form>
根据结果,会出现一个带有extendedDataTable的新表单(search_results_form_node),左键单击会生成另一个表单(search_results_form_service),右键单击会显示contextMenu。
<h:form id="search_results_form_node">
<a4j:outputPanel id="node_outputpanel">
<rich:panel id="node_panel"
rendered="#{not searchBean.insufficientCriteria}">
<h:outputText value="#{lbl.default_no_data_found}"
rendered="#{searchBean.isSearchResultNodeListEmpty}" />
<rich:extendedDataTable id="node_table"
value="#{searchBean.nodeList}" var="nod" iterationStatusVar="it"
rows="12" rendered="#{not empty searchBean.nodeList}"
selectionMode="single"
selection="#{searchBean.selectedNodeCollection}">
<a4j:ajax execute="@form" event="selectionchange"
listener="#{searchBean.nodeSelectionListener}"
render="search_results_form_service, panelGrid, tree_form, tree">
</a4j:ajax>
<rich:column sortBy="#{nod.priorityName.value}">
<f:facet name="header">#{lbl.search_results_priority_flag}</f:facet>
<h:graphicImage url="/resources/images/arrowup.png"
rendered='#{nod.priorityName.value.equals("Y")}'
style="width : 12%;" />
</rich:column>
<rich:column>...</rich:column>
<rich:column>...</rich:column>
</rich:extendedDataTable>
<rich:contextMenu id="contextMenu" target="node_table" mode="ajax" rendered="#{loginBean.auth.userAccesToCorporateSearchEdit}">
<rich:menuItem id="menuItem1"
label="#{lbl.task_list_context_menu_update_action}"
render="popupUpdateContext" mode="ajax"
actionListener="#{searchBean.updateNodeStatusToOrderSubm()}"
oncomplete="if (#{empty searchBean.updateNodeStatus} ) {#{rich:component('errorPopup')}.show()} else {#{rich:component('errorPopup')}.hide()}" />
<rich:menuItem label="Edit" render="popupContent"
action="#{searchBean.navigate('solutionManagement')}" mode="ajax" />
</rich:contextMenu>
</rich:panel>
</a4j:outputPanel>
</h:form>
问题如下:当页面第一次加载时,一切都很好。 search_results_form_service和contextMenu都呈现。但是,如果我再次按下搜索命令按钮,则不会渲染contextMenu。另外,从开发人员工具中我得到以下内容:
如果我刷新页面,一切都会很好。我也尝试在按下commandButton时渲染所有组件(render =&#34; @ all&#34;),但是虽然contextMenu工作,但是search_results_form_service不会被渲染。