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
ashokkumar.rrashokkumar.rr 

Dynamically add the tab inside tabpane

Hi guys,

I'm experiencing some unexpected behavior when trying to use the apex:repeat function to render tabs....

Basically it seems that tabs cannot be created on demand?  My controller is definitely returning data... as the second page block in my sample will show... repeat works - just the tabs are not rendered..

I'm sure any of you guys can see where I was going with this - and I guess I can achieve a similar result by dropping down to boring old html - just trying to use the standard components (as per best practice)

Any assistance greatly appreciated - as the purist coder me is seriously disturbed at the moment...

here is my 'simplified' and easily testable page & controller

Code: VF PAGE
<apex:page controller="clsRecordType">
    <apex:pageBlock >
        <apex:tabPanel id="theTabPanel">
            <apex:tab label="Account Types"/>
            <apex:repeat value="{!RecordTypes}" var="types">
                <apex:tab label="{!types.Name}"/>     
            </apex:repeat>
        </apex:tabPanel>
    </apex:pageBlock>

    <apex:pageBlock >
        <apex:repeat value="{!RecordTypes}" var="types">
            {!types.Name}<br/>       
        </apex:repeat>
    </apex:pageBlock>
</apex:page>


and the controller

Code:
public class clsRecordType {

    list<RecordType> lrecordtypes;

    public list<RecordType> getRecordTypes() {
        if(lrecordtypes==null) lrecordtypes = [Select Name, Id, Description From RecordType  where SobjectType = 'Account' and IsActive=True];
        return lrecordtypes;
        }
   }



jeremyyjeremyy

I believe apex:repeat elements cannot be used to generate apex:tab elements. There has been some hinting for a while that this would be fixed, but nothing official yet.