1
<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?

3

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>
0

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

  • 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. – Sergej 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 – Sergej Utko Nov 29 '12 at 10:59

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.