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
kannapapikannapapi 

Dynamic Tab Creation

Hi All,
i want  to create dynamic tab in visualforce. Under each tab i should have data table and apex:inputFile. The tab, datat table should have custom style.
how to achieve this? 

Visualforce:
<apex:dynamicComponent componentValue="{!myTabs}"/>

apex:

public Component.Apex.TabPanel getMyTabs()
{
//create parent panel
Component.Apex.TabPanel myTabPanel = new Component.Apex.TabPanel();
for (integer i=0;i<3;i++) //just a sample, this could easily be a SOQL loop
{
Component.Apex.Tab myTab = new Component.Apex.Tab();
myTab.Label = 'Tab ' + string.valueOf(i+1);
 //add child tabs to the parent myTabPanel.childComponents.add(myTab);
}
return myTabPanel;
}

 
Sumitkumar_ShingaviSumitkumar_Shingavi
I will suggest you to use simply <apex:repeat> in VF and then generate tabs inside it. So your syntax will look something like below:
<apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">
    <apex:repeat value{!lAccounts} var="acc">
         <apex:tab label="One" name="{!acc.Name}" id="{!acc.Id}">
             content for tab one
         </apex:tab>
    </apex:repeat>
</apex:tabPanel>
So for every Account in list it will generate a Tab.

PS: if this answers your question then hit Like and mark it as solution!
kannapapikannapapi

@Sumit 
apex:tab will not work with apex:repeat.. we have tried