You need to sign in to do that
Don't have an account?
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
<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
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; } }
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.