java - Update tab title in accordion -


i have primefaces 3.5 accordionpanel one:

<p:accordionpanel cache="false">     <p:ajax event="tabchange" listener="#{pprbean.onchangetab}" />     <p:tab title="item">         <h:outputtext value="#{pprbean.counter}"/>     </p:tab>     <p:tab title="item">         <h:outputtext value="#{pprbean.counter}"/>     </p:tab>     <p:tab title="item">         <h:outputtext value="#{pprbean.counter}"/>     </p:tab>     <p:tab title="item">         <h:outputtext value="#{pprbean.counter}"/>     </p:tab> </p:accordionpanel> 

and backing bean one:

package com.gecolsa.test.view;  import javax.ejb.stateless; import javax.faces.bean.managedbean; import javax.faces.bean.requestscoped; import org.primefaces.component.tabview.tab; import org.primefaces.event.tabchangeevent;  @stateless @managedbean @requestscoped public class pprbean {      private int counter = 0;     private string firstname;      public string getfirstname(){         return firstname;     }      public void setfirstname(string firstname){         this.firstname = firstname;     }      public int getcounter() {         return counter;     }      public void setcounter(int counter) {         this.counter = counter;     }      public void onchangetab(tabchangeevent event){         tab activetab = event.gettab();         if(!activetab.gettitle().endswith("[pressed]")){             activetab.settitle(activetab.gettitle() + " [pressed]");                     }         system.out.println(activetab.gettitle());         counter = counter + 1;     } } 

my question is: how can change title new value of counter? shows "item" although tab returns new value...(i wanna update title of tab in runtime wherever user clicks on it, additional information, hour , user clicked). i'm using glassfish 3.1.2.

you can update tab updating accordionpanel listener below:

public void onchangetab(tabchangeevent event){     tab activetab = event.gettab();     if(!activetab.gettitle().endswith("[pressed]")){         activetab.settitle(activetab.gettitle() + " [pressed]");                 }     system.out.println(activetab.gettitle());     counter = counter + 1;     requestcontext.getcurrentinstance().update("panel"); } 

where panel id of <p:accordionpanel id="panel">

since tab has no renderer have update whole panel instead of tab.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -