Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
<apex:component controller="MenuController">
    <apex:tabPanel switchType="client">
        <apex:repeat value="{!menus}" var="menu" id="theRepeat">
             <apex:tab label="{!menu.name}" name="{!menu.id}">content for tab one</apex:tab>
        </apex:repeat>
    </apex:tabPanel>
</apex:component>

Can any one please tell me what is wrong in this program? Why is this not creating a menus tab?

share|improve this question
up vote 3 down vote accepted

It is not supported. The apex:repeat component cannot be used as a direct child of the following components according to the apex:repeat docs.

This component cannot be used as a direct child of the following components:

  • <apex:dataTable>
  • <apex:pageBlockTable>
  • <apex:panelBar>
  • <apex:selectCheckboxes>
  • <apex:selectList>
  • <apex:selectRadio>
  • <apex:tabPanel>
share|improve this answer

So you want to create your tab dynamically. I think the better way to do this is to use dynamic component. Check the SF-Docs out:

Dynamic Visualforce Components

share|improve this answer
1  
True.. but i just wanted to know why my code is not working – Pramod Kumar Nov 29 '12 at 9:13
    
The <apex:tab> component must be a child of a <apex:tabPanel>. In your case it is NOT. – Sergey Utko Nov 29 '12 at 9:15
    
True ... but apex:repeat can be child of apex:tabPanel as written in docs. – Pramod Kumar Nov 29 '12 at 10:39
    
Maybe a bug-feature von salesforce – Sergey Utko Nov 29 '12 at 10:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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