且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

单击命令按钮后,如何动态地在选项卡视图中的选项卡视图中添加选项卡?

更新时间:2022-01-07 08:01:58

在方法addTab()中,您可以添加

TabView tabView = new TabView();
Tab newTab = new Tab();            
newTab.setTitle("Tab Title");       
tabView.getChildren().add(newTab); 

并且您应该更新视图以反映新选项卡.使用RequestContext进行Ajax更新.

And you should update the view to reflect the new tab. Use RequestContext for ajax update.

RequestContext context = RequestContext.getCurrentInstance();  
  context.update("tabview");