You need to sign in to do that
Don't have an account?

tabPanel: selectedTab issue
I'm having trouble setting the selectedTab attribute of a tabPanel dynamically. It works fine if I set selectedTab to a string in the visualforce page, but if I try and use something set by the controller it doesn't work. Am I missing something obvious or is there an issue with the tabPanel tag?
Controller:
Page:
URL:
The tab is selected properly if I use a static string, e.g.:
Any ideas?
Controller:
Code:
public class testTabController { String tabInFocus = System.currentPageReference().getParameters().get('tab'); public String getTabInFocus() { return tabInFocus; } public void setTabInFocus( String s ) { this.tabInFocus = s; } }
Page:
Code:
<apex:page controller="testTabController" sidebar="false" showheader="true"> <p>tabInFocus: <{!TabInFocus}></p> <apex:tabPanel switchType="client" selectedTab="{!TabInFocus}" id="testTabs"> <apex:tab label="Label 1" name="oneTab" id="tab1" > <p>This is number one</p> </apex:tab> <apex:tab label="Label 2" name="twoTab" id="tab2" > <p>This is number two</p> </apex:tab> <apex:tab label="Label 3" name="threeTab" id="tab3" > <p>This is number three</p> </apex:tab> </apex:tabPanel> </apex:page>
URL:
Code:
/apex/test_tab?tab=twoTab
Code:
<apex:tabPanel switchType="client" selectedTab="twoTab" id="testTabs">
The selectedTab attribute specifies thr DEFAULT tab to be displayed when the page is loaded.
The current active tab can be specified using the value attribute:
You'll need a setter for TabInFocus as well as a getter, because this binding will also pass the currently selected tab back to the controller.
All Answers
The selectedTab attribute specifies thr DEFAULT tab to be displayed when the page is loaded.
The current active tab can be specified using the value attribute:
You'll need a setter for TabInFocus as well as a getter, because this binding will also pass the currently selected tab back to the controller.
Note to the powers that be - the documentation and/or naming conventions could be a bit clearer on this topic.
Any suggestions, how to jump back to the last tab selected
Hi,
I am also facing the same problem.
http://boards.developerforce.com/t5/Visualforce-Development/Tab-Navigation/m-p/318363
Can anyone help on this topic??
Cheers,
Devendra S
Spent today working on this - see Keeping track of the selected tab of an apex:tabPanel in the controller for what I did.
Keith