Hi.

MyFaces 1.1.2 has a "server-side" feature of HtmlTabbedPane which allows switching panes on the server-side. This could be especially useful in case of tabs with a large number of components.

However, HtmlTabbedPaneRenderer still renders all of the tabs. Only one of the rendered tabs is visible, others are hidden. This makes no sense for the server-side pane switching. You don't need to render the hidden tabs, there's no possibility to switch onto them on the client side.

I'd like to suggest changing the writeTabsContents method so that invisible tabs are excluded in case of the server-side switching.

Could look as follows:
........
if (child instanceof HtmlPanelTab) {
        HtmlPanelTab tab = (HtmlPanelTab)child;
        if (tabbedPane.isClientSide())
        {
                writer.startElement(HTML.DIV_ELEM, tabbedPane);
                writer.writeAttribute(HTML.ID_ATTR, 
tab.getClientId(facesContext), null);
                // the inactive tabs are hidden with a div-tag
                if (tabIdx != selectedIndex) {
                        writer.writeAttribute(HTML.STYLE_ATTR, "display:none", 
null);
                }
                RendererUtils.renderChild(facesContext, child);
                writer.endElement(HTML.DIV_ELEM);
        }
        else
        {
               if (tabIdx == selectedIndex) {
                        RendererUtils.renderChild(facesContext, child);
                }
        }
        tabIdx++;
}
...........

Bye.
/lexi

Reply via email to