function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NatePoloNatePolo 

Trying to maintain tabPanel State

Hi all,

I'm pretty new to VF and have been trying to find the right mix of docs to solve my problem, but so far no luck. 

 

I have a VF page with apex:tabPanels for different related lists of my custom object. 

Unfortunately, when I navigate away from the page and come back, the default apex:tab is what is always displayed. Instead, I would like to display the last apex:tab that I was looking at.

 

Currently, the VF editor gives me the error:

Error: Unknown property 'SFDC_Project__cStandardController.ControlTabs'

 

VF Page

<apex:page standardController="SFDC_Project__c" extensions="ControlTabs" showheader="true" sidebar="true"">

<apex:form>
<apex:actionFunction name="setFocus" action="{!TabInFocus}"/>
</apex:form>

<apex:tabPanel width="90%" switchType="client" headerSpacing="5" value="{!TabInFocus}">
<apex:tab label="Project Milestones" id="pjMilestones">
tab 1
</apex:tab>
<apex:tab label="Team Members" id="tmTab">
tab 2
</apex:tab>
<apex:messages />
</apex:tabPanel>

</apex:page>

 

Controller extension:

 

 

public class ControlTabs {
// Get the value for the tab name from the URL. Name is "tab"
String TabInFocus = System.currentPageReference().getParameters().get('tab');
// Constructor
public ControlTabs(ApexPages.StandardController stdController) {
System.debug('Current Selected tab is :' + TabInFocus);
}

public String getTabInFocus() {
System.debug(' *****Current Selected tab is :' + TabInFocus);
return TabInFocus;
}

public void setTabInFocus( String s ) {
System.currentPageReference().getParameters().put('tab',s);
this.TabInFocus = s;
}


}

 

 

Ultimately, I want to be able to track the last tab I looked at and call it up when I view the page. 

I was thinking that I could set the TabInFocus on a onTabEnter or onclick event; hence the apex:actionFunction. 

 

 

I found some posts
that lead me to believe I could get/set the id. However, I think I'm
getting stuck in properly extending the standardController class for my
object. 

 

 

Any and all help would be much appreciated!

 

 

metaforcemetaforce

You'll have to write your own code to navigate to a specific tab on a custom VF page. Check out the following posts:

 

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&thread.id=3610&view=by_date_ascending&page=1

 

 

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=13309

 

Hope this helps.

 

Best metaforce

--------------------------------------------------------------------------------------------------

Markit as an accepted solution if it works and help the community