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
SalluSallu 

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)

 

etc.

 

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.

SargeSarge

Hi,

 

  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) .

 

 

cheers..

Shailesh DeshpandeShailesh Deshpande

yes doesnt work

paul-lmipaul-lmi

 

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

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

 

 

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.

 

 

DrawloopSupportDrawloopSupport

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

 

<apex:tabPanel>
    <apex:repeat>
        <apex:tab>
            content
        </apex:tab>
    </apex:repeat>
</apex:tabPanel>

Any comments from Salesforce on this?

 

Thanks!

 

ashokkumar.rrashokkumar.rr

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

Thibault WeberThibault Weber

Hi, 

 

You can go through this by using dynamic components.

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!
Neha@SfdcNeha@Sfdc
i just read that we can't place apex:repeat tag as a direct child of apex:tabPanel