0

I'm going crazy because i have this problem

i have this menu component

<rich:panelMenuItem label="Users" name="Users"  action="#{tabsBean.createTabs('tab Users')}" render="tabs" />       

   <rich:panel>
      <h:panelGrid id="tabs" binding="#{tabsBean.panelGrid}"/>
   </rich:panel>

when click on Users item menù add a new tab

@ManagedBean
@SessionScoped
public class TabsBean {

private HtmlPanelGrid panelGrid;
private UITabPanel tabPanel;
private List<UITab> tabsList;
private Application application;


public TabsBean() {

    tabsList = new LinkedList<UITab>();
    FacesContext context = FacesContext.getCurrentInstance();
    application = context.getApplication();
    tabPanel = (UITabPanel)application.createComponent(UITabPanel.COMPONENT_TYPE);
    tabPanel.setSwitchType(SwitchType.ajax);

}

public void createTabs (String name){       


    UITab tab = new UITab();
    tab = (UITab)application.createComponent(UITab.COMPONENT_TYPE);
    tab.setName(name);
    tabPanel.getChildren().add(tab);

    //I would add here a component to my new tab

    panelGrid.getChildren().add(tabPanel);


}

so everything is ok , but now I would like to add components to the new tab, for example the following table

 <rich:extendedDataTable id="UsersTable" value="#{userController.allUsers}" var="user" />
        <rich:column>
            <f:facet name="header">Id</f:facet>
            <h:outputText value="#{user.id}" />
        </rich:column>
        <rich:column>
            <f:facet name="header">Name</f:facet>
            <h:outputText value="#{users.name}" />

        </rich:column>
    </rich:extendedDataTable>

how can I do?

  • You are using `` and from your description I think you meant to use ``. Check this post: http://stackoverflow.com/questions/14319124/richfaces-dynamic-tabpanel – kauedg Jan 27 '13 at 13:06
  • The process is not too different from what you've done already with the tabs. Is that you've tried it and it doesn't work? – kolossus Jan 28 '13 at 05:33

0 Answers0