0

I'm using Primefaces 3.5 + MOJARA 2.2.

I'm trying to create a Master child kind of environment where we have all applications listed in one Tab with command buttons. Each command button will open up another tab in the same parent window.

To achieve this i'm using dynamic tabs with iframe

<p:tabView value="#{bean.tabs} var="tab">
     <p:tab title="#{tab.title}" closable="#{tab.closable}">
         <iframe src="#{tab.content}" class="ui-widget" width="100%" height="900px"/>
     </p:tab>
</p:tabView>

Here tabs is a List and Tab is a POJO.

class Tab{
     private String title;
     private String content;//URL
     private boolean closable;
     //GETTER SETTERS
}

in Backing bean i create a Tab where in show command buttons as below.

public class Bean{
    private List<Tab> tabs;
    ...

    public Bean(){
          tabs = new ArrayList<Tab>();
          Tab tab1 = new Tab("Applicaton","dispApplications.xhtml",false);
          tabs.add ( tab1 );
    }
}

dispApplications.xhtml

<h:form id="buttonForm">
      <h:panelGrid columns="6" border="0">
           <c:forEach var="dataItem" items="${bean.applications}">
               <h:column>
                   <p:graphicImage value="/images/#{dataItem.icon}"/>
                   <p:commandButton binding="#{bean.cmdButton}"/>
               </h:column>
           </c:forEach>
      </h:panelGrid>
</h:form>

Problems: I'm able to show initial "Applications" Tab. However when i try to invoke each application i had to force reloading of the entire page to get the tabs loaded. This i'm doing cmdButton.setOnClick("parent.location.href = parent.location.href") for each commandButton which is bound to Bean. I also created an inline processListener for cmdButton which creates an instance of "Tab" and adds it to tabs.

  • I want to avoid complete page reloading to show tabs.
  • I want to highlight the new tab that is added/opened recently..
  • Tabclose is always closing first tab no matter which tab i try closing. Online primefaces showcase shows very clean implementation but i guess this works in 4.0 and hopefully this is a bug in 3.5 version.

This link from Baluc

has provided lot of help, but this is based on tabChange event and also the update is done using requestContext. This is not working when i use iframe.

Any other approach is also welcome. Thanks in advance

4

0 回答 0