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
GoForceGoGoForceGo 

Using Tabs inside repeat...

Code:
<apex:page Controller="testController">
<apex:tabPanel switchType="ajax" id="theTabPanel">
<apex:repeat value="{!stringList}" var="astring" id="theRepeat">
<apex:tab label="{!astring}">
</apex:tab>
</apex:repeat>
</apex:tabPanel>
</apex:page>



Code:
public class testController {

String[] ss;
public String[] getStringList() {
return ss;
}

public testController() {
this.ss = new String[]{'a', 'b', 'c'};
}

}


I want to create a variable number of tabs with repeat statement. The code above doesn't work...Any work arounds anyone can think of?



 

 
ciccic
If you know what tabs are possible in the list: you can create them all without a repeat loop and then set a "rendered" condition to see if that tab is to show on this page render.
GoForceGoGoForceGo
Thanks. I am doing something similar - just listing all the tabs.  In my case, I need to render all of them, but the number of tabs is variable.

The problem is that most of the code is duplication across tabs - hassles in maintainence - in one case I have listed 15 tabs.

I was  hoping I could use a repeat statement to just use one tab tag and have the system duplicate it.


adflintadflint
here is an idea for SFDC to support apex:tab inside of apex:repeat:

https://success.salesforce.com/ideaView?id=08730000000l3gHAAQ

Please vote for the idea!