admin管理员组

文章数量:1026989

I have three tabs that i'm setting active, due to a certain functionality, the last active tab might not be the one the user on. So at the end of this 3 line code i'm trying to set active the tab that the user is on:

tabPanel.setActiveTab(1);
  tabPanel.setActiveTab(2);
  tabPanel.setActiveTab(0);

I want to set the current tab the tab that the user is on, (the active tab). Any help on this?

I have three tabs that i'm setting active, due to a certain functionality, the last active tab might not be the one the user on. So at the end of this 3 line code i'm trying to set active the tab that the user is on:

tabPanel.setActiveTab(1);
  tabPanel.setActiveTab(2);
  tabPanel.setActiveTab(0);

I want to set the current tab the tab that the user is on, (the active tab). Any help on this?

Share Improve this question edited Jan 18, 2016 at 15:58 mikeb asked Jan 18, 2016 at 15:45 mikebmikeb 7272 gold badges9 silver badges35 bronze badges 6
  • Can you explain it again? question is unclear – Vladimir Commented Jan 18, 2016 at 15:49
  • 1 Can you explain what do you want exactly? Active tab is the one which on which user is currently on. What do you want to set? Framework automatically sets the value for active tab. – Abdul Rehman Yawar Khan Commented Jan 18, 2016 at 15:51
  • @Style i edit the question – mikeb Commented Jan 18, 2016 at 15:58
  • @AbdulRehmanYawarKhan i edit the question – mikeb Commented Jan 18, 2016 at 15:59
  • Maybe you meant enabled? You want set all 3 tabs enabled and set first one active? – Vladimir Commented Jan 18, 2016 at 16:06
 |  Show 1 more ment

1 Answer 1

Reset to default 3

You can do something like this:

var currentTab = tabPanel.getActiveTab();

tabPanel.setActiveTab(0);
tabPanel.setActiveTab(1);
tabPanel.setActiveTab(2);

tabPanel.setActiveTab(currentTab);

I have three tabs that i'm setting active, due to a certain functionality, the last active tab might not be the one the user on. So at the end of this 3 line code i'm trying to set active the tab that the user is on:

tabPanel.setActiveTab(1);
  tabPanel.setActiveTab(2);
  tabPanel.setActiveTab(0);

I want to set the current tab the tab that the user is on, (the active tab). Any help on this?

I have three tabs that i'm setting active, due to a certain functionality, the last active tab might not be the one the user on. So at the end of this 3 line code i'm trying to set active the tab that the user is on:

tabPanel.setActiveTab(1);
  tabPanel.setActiveTab(2);
  tabPanel.setActiveTab(0);

I want to set the current tab the tab that the user is on, (the active tab). Any help on this?

Share Improve this question edited Jan 18, 2016 at 15:58 mikeb asked Jan 18, 2016 at 15:45 mikebmikeb 7272 gold badges9 silver badges35 bronze badges 6
  • Can you explain it again? question is unclear – Vladimir Commented Jan 18, 2016 at 15:49
  • 1 Can you explain what do you want exactly? Active tab is the one which on which user is currently on. What do you want to set? Framework automatically sets the value for active tab. – Abdul Rehman Yawar Khan Commented Jan 18, 2016 at 15:51
  • @Style i edit the question – mikeb Commented Jan 18, 2016 at 15:58
  • @AbdulRehmanYawarKhan i edit the question – mikeb Commented Jan 18, 2016 at 15:59
  • Maybe you meant enabled? You want set all 3 tabs enabled and set first one active? – Vladimir Commented Jan 18, 2016 at 16:06
 |  Show 1 more ment

1 Answer 1

Reset to default 3

You can do something like this:

var currentTab = tabPanel.getActiveTab();

tabPanel.setActiveTab(0);
tabPanel.setActiveTab(1);
tabPanel.setActiveTab(2);

tabPanel.setActiveTab(currentTab);

本文标签: javascriptSetting active tab current tabStack Overflow