How to add tabs in tabview in primefaces, dynamically, on click of a command button?

前端 未结 1 1773
独厮守ぢ
独厮守ぢ 2021-01-16 10:36

How do I add tabs in tabview in primefaces, dynamically, on click of a command button using ajax?

     

        
相关标签:
1条回答
  • 2021-01-16 11:05

    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");
    
    0 讨论(0)
提交回复
热议问题