[英]p:commandbutton update does not work
我在各個論壇中進行了搜索,並且知道HTML-DOM-Element的id生成如何與NamingContainers一起使用,而沒有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。
我在這里想念什么? 在此先多謝!
嘗試使用action
代替actionListener
。 另外,僅更新wbmanageForm
。 如果那不起作用,請嘗試使用bean方法更新組件。
您可以通過將其添加到方法的末尾來做到這一點: RequestContext.getCurrentInstance().update("wbManageForm");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.