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
Devendra@SFDCDevendra@SFDC 

Switch ON/OFF tabs from Tabpanel

 

Hello Board,

 

I have created  tab for custom object Job__c, which is overidden by VF page.

 

The overrided page show Job information in <apex:Tabpanel>

 

The first tab in tabpanel is used to display Job detail information.

 

The other tabs are used to display related list for that Job.

 

The tabpanel is structure is like this:

 

<apex:page>
<apex:form>
<apex:tapanel>
<apex:tab label="Detail">
<apex:detail/>
</apex:tab>

<apex:tab label="Related List 1">
<apex:relatedList subject="{!Job__c}" list="Job_Specs__r"/> 
</apex:tab>

<apex:tab label="Related List 1">
<apex:include pageName="VF_page1"/> 
</apex:tab>
</apex:tabpanel>
</apex:form>
</apex:page>

 

I want to switch on-off these tabs based on User requirement. Is there any way to do this?

As, these tabs are from displayed using visualforce page Tabpanel.

 

Thanks,
Devendra

 

 

Best Answer chosen by Admin (Salesforce Developers) 
JpaqJpaq

We had a similar issue, needed to not render certain tabs for a Visualforce page (overrides Account) when a user does not have access to the tab object.

 

After reading this page

http://blog.deliveredinnovation.com/2011/02/05/render-visualforce-components-dynamically-based-on-object-level-security/

 

we used

 

rendered="{!$ObjectType.myCustomObject__c.accessible}"

 

 

 

All Answers

sreenathsreenath

Hi Devendra,

 

                   I did tab navigation similarly with user input. if you give tabname it automatically selects the tab.

 

 

<apex:tabPanel switchType="client" value="{!TabInFocus}" id="testTabs">

<apex:tab label="oneTab" name="oneTab" id="tab1" >
<p>This is number one</p>
</apex:tab>

<apex:tab label="twoTab" name="twoTab" id="tab2" >
<p>This is number two</p>
</apex:tab>

<apex:tab label="threeTab" name="threeTab" id="tab3" >
<p>This is number three</p>
</apex:tab>

</apex:tabPanel>
<apex:form >
<apex:inputText value="{!tname}" id="theTextInput"/>
<apex:commandButton action="{!gotoquestions}" value="go" id="theButton"/>
</apex:form>

Devendra@SFDCDevendra@SFDC

 

Thanks sreenath for reply.

 

But my requirement is different.

 

This page will be used in managed package. Thus it will be used by different subscribers. Hence a subscriber will decide which tab from tabPanel wants use.

 

So i am looking for a way to display tabs based on subsciber demand. 

 

Thanks,

Devendra

cvuyyurucvuyyuru

hey!! You can use rendered functionality on Tabs.

 

 

try this

 

<apex:tab rendered="{!visible}"/>

 

based on User, you can make it visible in apex class.

 

 

Thanks

JpaqJpaq

We had a similar issue, needed to not render certain tabs for a Visualforce page (overrides Account) when a user does not have access to the tab object.

 

After reading this page

http://blog.deliveredinnovation.com/2011/02/05/render-visualforce-components-dynamically-based-on-object-level-security/

 

we used

 

rendered="{!$ObjectType.myCustomObject__c.accessible}"

 

 

 

This was selected as the best answer
Devendra@SFDCDevendra@SFDC

Hi Jpaq,

 

I used the same syntax in my page. But I forget to mention on Board.

 

Thanks a lot:)

 

Thanks,

Devendra