How do I add tabs in tabview
in primefaces
, dynamically, on click of a command button using ajax?
In the method addTab()
, you can add,
TabView tabView = new TabView();
Tab newTab = new Tab();
newTab.setTitle("Tab Title");
tabView.getChildren().add(newTab);
And you should update the view to reflect the new tab. Use RequestContext
for ajax update.
RequestContext context = RequestContext.getCurrentInstance();
context.update("tabview");