私は短い例を作りました:
<h:form id="form">
<p:tabView id="tabview">
<p:tab title="tab 1">
<p:commandButton value="update" update="@parent" />
</p:tab>
<p:tab title="tab 2">
<p:outputPanel id="tab2">
<p:commandButton value="update" update=":form:tabview:tab2" />
</p:outputPanel>
</p:tab>
</p:tabView>
</h:form>
p:tab
ただし、 ID または (タブ 1 のように) を使用して更新すると@parent
、タブ (div) が削除され、奇妙になります... 回避策は、タブ 2 で行ったように、タブのコンテンツをコンテナーにラップすることです.
はっ!タブを直接更新できない理由を見つけました: https://code.google.com/p/primefaces/issues/detail?id=3518
タブビューの外にあるボタンの例:
<h:form id="form">
<p:tabView id="tabview" binding="#{tabView}">
<p:ajax event="tabChange" update=":form:button" />
<p:tab title="tab 1">
<p:outputPanel id="tab0">
<p:panel>text</p:panel>
</p:outputPanel>
</p:tab>
<p:tab title="tab 2">
<p:outputPanel id="tab1">
<p:panel>text</p:panel>
</p:outputPanel>
</p:tab>
</p:tabView>
<p:commandButton id="button" value="update"
update=":form:tabview:tab#{tabView.activeIndex}" />
</h:form>