This is a migrated thread and some comments may be shown as answers.

After .set_visible(false), .set_visible(true) doesn't work

2 Answers 136 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 12 Jun 2013, 03:01 PM
Hi All,

Weird problem.  Here's what's up:

  • I hide tabs client side via .set_visible(false).
  • When I go to show tabs via .set_visible(true) -- after the .set_visible(false) -- they do not display.

Here is my specific function: 

function v_JobRTS(positiontype) {
 
    var JobRTS = $find("<%=JobRTS.ClientID %>");
    var moretab = JobRTS.get_tabs().getTab(1);
    var finishtab = JobRTS.get_tabs().getTab(2);
 
    if (positiontype == "0" || positiontype == "1") {
         
        //Here is the section that doesn't work.
        moretab.set_visible(true);
        finishtab.set_visible(true);
 
    } else if (positiontype == "2") {
 
        moretab.set_visible(false);
        finishtab.set_visible(true);
 
    } else {
 
        moretab.set_visible(false);
        finishtab.set_visible(false);
 
    }
 
}

Here are some things I've tried:

  • Repainting the tab strip.
  • Finding the tabs themselves using different methods outlined in the documentation. 
  • Stepping through the code carefully.

When I step through the code, it goes right past the desired functions with no effect.

Thanks,

Jim

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jun 2013, 10:36 AM
Hi,

I have tried setting visibility of TabStrip using set_visible(). Here is my code.
JS:
function OnClientClick()
 {
    var tab = $find("<%=tab1.ClientID %>");
    var tab1 = tab.get_tabs().getTab(1);
    var tab2 = tab.get_tabs().getTab(2);
    if(tab1.get_visible())
      tab1.set_visible(false);
    else
      tab1.set_visible(true);
    tab2.hide(); // there is hide/show method also.
    return false;
 }
Note: this change does not persist after a postback.

Thanks,
Shinu.
0
James
Top achievements
Rank 1
answered on 14 Jun 2013, 11:47 AM
Hi All,

On a long run, I figured this issue out.  The problem is occurring because I hade the Align property set to "Justify."  If you think about it, it makes sense that the problem might occur.  When the tab control is reduced to 1 tab, that tab will take up 100% of the available space for the TabStrip.  When the remaining tabs are later called to be visible, they have "no place to go," or they seem to be falling "beneath" the initial tab.

I entirely resolved this by fixing the TabStrip width as well as the tab sizes.

Thanks,

Jim
Tags
TabStrip
Asked by
James
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
James
Top achievements
Rank 1
Share this question
or