I'm trying to update a outputPanel component when a tabView is changed but I could not find the way. Otherway I found was to update the complete form but I would rather to update only the component.
I tried update with :frmTest:grpButtons and frmTest:grpButtons, and the only thing it worked was frmTest.
Any idea about what is wrong.
test.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/template.xhtml">
<ui:define name="pageTitle">Test</ui:define>
<ui:define name="content">
<h:form id="frmTest" prependId="true">
<div class="Container100">
<div class="ContainerIndent">
<div class="Card ShadowEffect TexAlLeft">
<p:tabView id="tabView">
<p:ajax event="tabChange" listener="#{testBean.onTabChange}"
update=":frmTest:grpButtons"/>
<p:tab title="First" id="tab1">
<div class="Card ShadowEffect TexAlCenter">
<br/>
<h2>Empty Page 1</h2>
<br/>
<span class="gray">Use this page to start from scratch and place your custom content.</span>
<br/><br/>
</div>
</p:tab>
<p:tab title="Second" id="tab2">
<div class="Card ShadowEffect TexAlCenter">
<br/>
<h2>Empty Page 1</h2>
<br/>
<span class="gray">Use this page to start from scratch and place your custom content.</span>
<br/><br/>
</div>
</p:tab>
</p:tabView>
<p:separator/>
<p:outputPanel id="grpButtons" rendered="#{testBean.showButtons}">
<p:commandButton id="btnSaveSol" value="#{msgs.save}"
styleClass="Fright GreenButton"
action="#{testBean.save}"
ajax="true"
update=":frmTest"/>
</p:outputPanel>
</div>
</div>
</div>
</h:form>
</ui:define>
</ui:composition>
TestBean.java
@ViewScoped
@ManagedBean
public class TestBean implements Serializable {
private static final long serialVersionUID = 4078818945032342504L;
private Arxiu arxiu;
private boolean showButtons = true;
@PostConstruct
private void init() {
loadLocale();
}
//----------------------------------------------------------------
// Methods
//----------------------------------------------------------------
public void onTabChange(TabChangeEvent event) {
showButtons = !event.getTab().getId().equals("tab2");
}
public void save() {
System.out.println("save");
}
//Getters and setters
}