I am using a p:accordionPanel
instead of a p:dataTable
. Every time I change a tab, I would like to reset the active tab's entity ID within the controller. IOW, if the tabs in the accordionPanel correspond to entities whose IDs are 1, 2, 3, when I select one, I want the activeEntityID variable in the controller to be reset to the corresponding ID:
<p:accordionPanel value="#{litigController.appealsForCase}" var="appeal">
<p:ajax event="tabChange" listener="#{litigController.setSelectedAppeal}"/>
<p:tab id="#{appeal.appealID}" title="Appellate Court No #{appeal.appelateCourtNo}">
Controller method:
public void setSelectedAppeal(TabChangeEvent event) {
this.activeAppealID = event.getTab().getId();
System.out.println("tab change for appealID " + this.activeAppealID);
}
However, I get an IllegalArgumentException
:
java.lang.IllegalArgumentException: Empty id attribute is not allowed
How can I link identity between each tab in my accordionPanel and the controller. I tried modeling my code after this example, but their example is poor because it uses the tab title and not an id.