我已经通过论坛进行了搜索,并且知道HTML-DOM-Elements的id-generation如何与NamingContainers一起使用并且没有它们。尽管如此,在这段代码中,我尝试在页面的一侧放置一个命令按钮,它应该触发页面另一面的更新。
'viewWorkbenchButton'正确触发其动作,后端数据正常。但是:wbManageForm:wbMgmtPanel没有更新。
<ui:composition xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<f:view>
<p:panel id="dataGridPanel">
<p:panelGrid id="dataGridPanelGrid" styleClass="pGrid" columns="2"
columnClasses="alignTop, alignTop">
<p:column>
<h:form id="wbSelectForm">
<p:panel styleClass="noBorderPanel">
<p:dataTable var="workbench"
value="#{WorkbenchControllerBean.myWorkbenches}"
paginator="#{WorkbenchControllerBean.myWorkbenches.size() > 10}"
rows="10"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}">
<f:facet name="header">
My Workbenches
</f:facet>
<p:column headerText="Id" sortBy="#{workbench.workbenchId}">
<h:outputText value="#{workbench.workbenchId}" />
</p:column>
<p:column headerText="Name" sortBy="#{workbench.name}">
<h:outputText value="#{workbench.name}" />
</p:column>
<p:column headerText="Actions">
<p:commandButton id="viewWorkbenchButton" icon="ui-icon-show"
title="View Workbench" update=":wbManageForm:wbMgmtPanel"
actionListener="#{WorkbenchControllerBean.viewWorkbench(workbench)}">
</p:commandButton>
</p:column>
</p:dataTable>
</p:panel>
</h:form>
</p:column>
<p:column>
<h:form id="wbManageForm">
<p:panel id="wbMgmtPanel" styleClass="noBorderPanel">
<h:outputText id="tabText" value="Active Wb: #{WorkbenchControllerBean.number}" />
<p:tabView id="tabView">
....
</p:tabView>
</p:panel>
</h:form>
</p:column>
</p:panelGrid>
</p:panel>
</f:view>
我已尝试更新不同的组件(:wbManageForm
,:wbManageForm:tabText
,:wbManageForm:tabView:treetable
),但都没有更新...
我使用的是Primefaces 3.5。
我在这里缺少什么?非常感谢提前!
答案 0 :(得分:-1)
尝试使用action
代替actionListener
。此外,仅更新wbmanageForm
。如果这不起作用,请尝试使用bean方法更新组件。
您可以将此方法添加到方法的末尾:RequestContext.getCurrentInstance().update("wbManageForm");