3

I have created dynamic tabs using following code -

public Component.Apex.TabPanel getMyTabs()
{
    Component.Apex.TabPanel myTabPanel = new Component.Apex.TabPanel();  
     for (integer i=0 ;i<menus.size();i++)  //just a sample, this could easily be a SOQL loop
     {
         Component.Apex.Tab myTab = new Component.Apex.Tab();
         myTab.Label = menus.get(i).name;
         myTab.name =  menus.get(i).name;
         myTab.switchtype = 'client';
         //Want to associate a VF page with this Tab so that if someone Click this tab  
         associated VF page content render in body part.
         myTab.style='font-family: Arial, Helvetica, sans-serif; color: #000000;  background-image: url(/dimg/portalTabActiveRight000099C2E4FE.gif)';
         myTabPanel.childComponents.add(myTab);
     }   
    return myTabPanel;
}

I Want to associate a particular VF page with each Tab so that if someone Click that tab
associated VF page content render in the body part.

menus list also contains target VF page related path which will be displayed when user clicks in respective tab.

I am not getting anything how to do this. Can someone help me plz

3

did u try using <apex:iframe src="Vf_page"> in the page and embed the vf

  • I tried - Component.Apex.Iframe iframe = new Component.Apex.Iframe(); iframe.src = '/apex/HelloWord'; myTab.childComponents.add(iframe); – Pramod Kumar Nov 30 '12 at 7:20
  • But Not working – Pramod Kumar Nov 30 '12 at 7:20
  • wht happend when you tried ifram is the section not rendering still?? – Rao Nov 30 '12 at 7:21
  • Its working now.. my mistake. Can i not use apex:include instead of Component.Apex.Iframe? – Pramod Kumar Nov 30 '12 at 7:30
  • i have never tried using include but from this doc looks like you can salesforce.com/us/developer/docs/pages/Content/… – Rao Nov 30 '12 at 7:35
1
 <apex:outputLink value="{!$Page.calypso_latest_news}?cat=press releases">Press releases</apex:outputLink></li> 

I think I've had the same problem before We have news section where it renders to different categories e.g. Events, press releases and I use the link above to render it.
There is also a different thing you can do on the vf page in order to display different information, specific for different categories

<apex:outputText value="Product launches" rendered="{!$CurrentPage.parameters.cat='product launches'}" />
<apex:outputText value="Events" rendered="{!$CurrentPage.parameters.cat='events'}" />




<apex:outputText value="Find out the latest about" rendered="{!$CurrentPage.parameters.cat='press releases'}" />
<apex:outputText value="Incident Updates" rendered="{!$CurrentPage.parameters.cat='incident updates'}" />**

So if you have 3 tabs you can put

  <apex:outputLink value="{!$Page.Tab1}?cat=info1 ">Tab1</apex:outputLink></li>
  <apex:outputLink value="{!$Page.Tab1}?cat=info2 ">tab2</apex:outputLink></li>
  <apex:outputLink value="{!$Page.Tab1}?cat=info3 ">Tab3</apex:outputLink></li> 

And render information using

<apex:outputText value="Some Info Here" rendered="{!$CurrentPage.parameters.cat='info1'}" /> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.