I'm using PrimeFaces 5.1. I have a TabView component in which the tabs are generated dynamically:
<p:tabView scrollable="true"
id="tabView"
dynamic="true" cache="false"
value="#{reportTabBean.tabs}"
var="tab"
activeIndex="#{reportTabBean.activeTab}">
...
</p:tabView>
The content of a tab is wrapped in a <p:outputPanel>.
Inside the panel is a mix of plain HTML <table>
tags and <ui:____>
components. The tab contents make up a report. Each report has clickable elements created by <p:commandLink>
that called a method in the manged bean. Here's is the simplified code:
<p:outputPanel id="bcx-scorecard-panel"
rendered="#{ tab['class'].simpleName eq 'CSAE2EScorecardShowTab'}">
<ui:repeat var="LOB"
value="#{tab.scorecardCSAE2E.getLOBs()}">
<table>
<tbody>
<ui:repeat var="metric"
value="#{tab.scorecardCSAE2E.getMetrics(LOB.filter)}">
<ui:fragment rendered="#{metric.type == 'metric'}">
<tr>
<ui:repeat var="dayNum"
value="#{tab.scorecardCSAE2E.daysInMonthIterator()}">
<td>
<ui:fragment
rendered="#{null != metric.getDataFor(dayNum).value and metric.showDogEar(dayNum)}">
<p:commandLink
immediate="true"
update=":dialogExceptionFillWriteOff, :exceptionFillWriteOffForm"
action="#{exceptionWriteBean.populateExceptionPopup(tab.title, LOB.filter, null, metric, tab.scorecardCSAE2E, dayNum)}"
oncomplete="PF('dlgExceptionFillWriteOff').show()">
#{metric.getDataFor(dayNum).value}
</p:commandLink>
</ui:fragment>
</td>
</ui:repeat>
</tr>
</ui:fragment>
</ui:repeat>
</tbody>
</table>
</ui:repeat>
</p:outputPanel>
Clicking the commandLink brings up a model dialog that displays details about that cell. Each cell represents data for a particular day. The problem is the dialog works only for the last tab. I can click each table cell and it'll display the correct data for that day. When I switch to a different tab and click on cells, the populateExceptionPopup
method doesn't get called and instead the dialog shows the last pulled data from the other tab.
My beans are view scoped. I'm not sure if it has anything to do with it, but I'm using CDI beans and annotations. Here's one of the beans.
@Named("reportTabBean")
@ConversationScoped
public class ReportTabBean implements Serializable {
...
}