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

Create Tabs and TabPanels Dynamically.

I have a requirement where i need to create a page having many tabs as well as tabPanels. The number of tabs to be displayed is decided at run time. i tried using tabPanel inside repeat but it renders tabPanels again and again but not the tabs. Is there any way to do this using visualforce?


for eg: say i have three tabPanels:


tabPanel 1 :


tab1 tab2 tab3

this contains three tabs(say)


tabPanel 2 :

tab 1 tab 2

this contains two tabs(say)




again when next time i render the page, tabPanel 1 may have 4 tabs and also the page may have an added, tabPanel with multiple tabs.



Any Suggestion will be appreciated.


Thanks in advance.




  Have you tried <apex:repeat/> component?  You just need to hold the count of number of tabs and tabpanels in controller, refer them in specific <apex:repeat/> component and refresh the page (possibly ajax kind of refresh) .




Shailesh DeshpandeShailesh Deshpande

yes doesnt work



<apex:page controller="CampfireChatCon" sidebar="false">

<apex:tabpanel id="tabpanelROOM" switchType="client">
	<apex:tab label="test">
		test content
	<apex:repeat id="repeattabs" var="t" value="{!RoomsList}">
		<apex:tab label="{!}" >
		     TODO: Add Content for the tab



this definitely doesn't (but should) work


the test tab renders, but not the other ones, of which in my testing should be 6 tabs.




This still does not work. It would be great to be able to do the following:



Any comments from Salesforce on this?





I am also facing the same issue. did  u get any solution for this problem plz let me know

Thibault WeberThibault Weber



You can go through this by using dynamic components.

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

Please vote for the idea!
i just read that we can't place apex:repeat tag as a direct child of apex:tabPanel