Sometime there is project requirement to change the tab title of currently selected tabs. This can be a common feature in any application. I am explaining a way to update the tab title using the Java code.
But there is a requirement to pass tabContext parameter to your task flow definition because this piece of code require the access to TabContext.
public void resetTabTitle(String title) { //Retrieve TabContext current instance TabContext tabContext = TabContext.getCurrentInstance(); //Retrieve selected tab index int index= tabContext.getSelectedTabIndex(); //Retrieve Selected tab Tab currentTab = tabContext.getTabs().get(index); //Set the new title for tab currentTab.setTitle(title); //Here I am setting the selected tab index so //that currently selected tab can be refresh tabContext.setSelectedTabIndex(index); }
It works for me, lets try it at your end.
It solved a big trouble for me, very useful, thank you so much for sharing (Y)
ReplyDelete