我使用Primefaces 3.4(也嘗試3.3)和Mojarra 2.1.7。但是我在更新p:tabView中的動態選項卡時遇到問題。動態Primefaces:tabView不更新
我有2個按鈕應該添加一個額外的選項卡。第一個按鈕位於p:tabView之外。當點擊這個按鈕時,支持bean被調用,p:tabView被更新,並且新的選項卡被顯示。但是,當我點擊第二個按鈕,該按鈕位於tabView的選項卡內時,將調用輔助bean,但tabView不會更新。
缺少更新僅在動態選項卡中發生。當我修改給定的例子只有一個選項卡,並顯示一個點擊按鈕時發生變化的值時,tabView會被兩個按鈕更新,並顯示新值。所以這只是在動態標籤中出現的問題。
這是我的代碼。
<f:view contentType="text/html">
<h:form>
<p:commandButton value="press me" action="#{idTestBean.addTab}" update=":ApplicationTab"/>
</h:form>
<p:tabView id="ApplicationTab" cache="false" dynamic="false" var="tab" value="#{idTestBean.tabList}">
<p:tab title="tab" closable="false" >
<p:panel>
<h:form>
<p:commandButton value="press me" action="#{idTestBean.addTab}" update=":ApplicationTab"/>
</h:form>
#{idTestBean.count}
</p:panel>
</p:tab>
</p:tabView>
</f:view>
不同的選項卡包含需要單獨提交的單獨表單。因此我有不止一種形式的方法。
你爲什麼使用2個窗體標籤?嘗試將所有內容放在一個表單標記中 – Tankhenk