under specific circumstances (not always), active tab in a tabView is changed when the tabView is updated by <p:ajax>. To reproduce the issue, use the code below and follow these steps:
- Switch to the second tab
- Switch back to the first tab
- Change the value in the select
Code: Select all
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</h:head>
<h:body>
<h:form>
<h:selectOneMenu>
<f:selectItem itemLabel="Item 1" />
<f:selectItem itemLabel="Item 2" />
<p:ajax event="change" update="tabs" />
</h:selectOneMenu>
</h:form>
<h:form id="mainForm" prependId="false">
<p:tabView id="tabs" dynamic="true">
<p:tab title="Tab 1">
<h:outputText value="Tab 1" />
</p:tab>
<p:tab title="Tab 2">
<h:outputText value="Tab 2" />
</p:tab>
</p:tabView>
</h:form>
</h:body>
</html>