Search code examples
gwtgwt2

GWT: TabPanelLayoutPanel hide or show Tabbaritems


Is there any way to hide/show TabBar items in TablayoutPanel


Solution

  • setVisible will just set the style attribute display to none . So you can create your own API like this,

     public void hideTabItem ( Widget tabItem, boolean hideFl )
     {
         hideTabItem ( tabItem.getElement(), hideFl );
                            OR
         tabItem.setVisible ( hideFl );
     }
    
    private static native void hideTabItem (Element elem, boolean visible) 
    /*-{
         elem.style.display = visible ? '' : 'none';
         elem.setAttribute('aria-hidden', String(!visible));
     }-*/;
    

    NOTE: To know more about aria-hidden property visit the link Aria-Hidden-Property