No announcement yet.
  • Filter
  • Time
Clear All
new posts

    Conditionally show a tab

    I have a values manager, including a TabSet. I want some tabs in it to be only shown for certain conditions of the values manager's values.
    I've tried to add the undocumented showIf() method in the tab and this hides the tab, but doesn't remove the space it takes and this is what I would like to have. Also, I don't think I should use this undocumented feature.

    I've tried something else with a redraw() method on the layout rendering the values manager but this doesn't quite work in all situations.

    So I guess you guys have a much better idea that what I could come up with. Any help is appreciated.

    BTW, using SmartClient 12.1 2022-01-12 (for some other reasons I can't update right now).

    Hello, I'm not sure of what you mean by a valuesManager including a TabSet, but did you try visibleWhen on the tab?


      Hi claudiobosticco,

      visibleWhen is only in 13.0p, not in 12.1p.

      Best regards


        Hi Blama,
        I didn't noticed that wallytax mentioned he's stuck on 12.1.
        For 12.1 I think this is still relevant:


          Hi claudiobosticco . That link points indeed to the same situation I have. By the way, I did a search on this but apparently didn't find that post.

          Reading that thread, I come to the conclusion that - at least in 2016 - it isnt' officially possible to hide/show tabs. I already have something working and it uses tab.hide() and and this almost works. I've put the call inside a redraw() method of the containing component and it works, except for the first call. If I open the page and it requires a scrollbar, it already works, because the screen is redraw. Except when there's no need to redraw in the beginning it fails. I even put the call in the initWidget() method, but it seems to be too early.

          Thus, it was already working for 95%, but that last 5%... ;-)

          So my new question is: what would be the place(s) in the containing component to call the or tab.hide(). I've dug a bit in the code, but could not find the right spot. I'm guessing it might be layoutChildren() in the tabBar subcomponent of TabSet.


            On older versions, you cannot hide and show tabs, only add and remove. This accomplishes the same thing if you turn off automatic destruction of the pane when the tab is removed. See this doc:


            On older versions, do not attempt to directly hide and show tab instances, this will not work and is not supported. Either use the documented approach above, or upgrade.


              Is "older versions" < 13? Of is 12.1 supported? Since it seems to be (almost) working. Or is that "almost" the part that's not supported? :-)


                To see if something is supported, just look at the docs.

                There is no hideTab(), so it is not supported. hideTab() is present in 13.0 docs.

                A lot of hacks will get you "almost" there. Often, with a hack, you may perceive yourself as 95% of the way there with 5% to go. In fact, you are 5% of the way there with 95% of the way to go.

                So again our advice is to use the documented approach in 12.1, or upgrade.


                  Thanks for the reply. Is there a way to look at older docs? Or should I use the SDK locally and check the docs locally?

                  BTW, I'm not using the hideTab/showTab methods, I did see that they only exist in version 13. But hide/show on individual tabs, but apparently those are undocumented.

                  For now, if it use that removeTab/addTab approach, what would be the right place to insert that calls?


                    Documentation for all versions is available under the Documentation link (

                    Place the code wherever you want to hide or show a tab.