+ Start a Discussion
Dominic SebastianDominic Sebastian 

Creating a button where in the button will make additional tables using apex:repeat.


<apex:repeat>
<apex:pageBlockTable id="pbt" value="{!mapStateLicense}" var="key" styleClass="licenseTable" columnsWidth="55px,90px,110px,90px,157px,135px !important">
               <!-- <apex:commandButton value="Add licenses" action="{!insertStateRecords}" style="margin-left: 9px!important;margin-top: -50px !important;position: absolute;"/>-->
                <apex:column headerValue="State" value="{!mapStateLicense[key].locationState}" styleClass="stateHead" style="width:55px !important; text-align:center;"/>                
                <apex:column headerValue="License No.">
                    <apex:inputText value="{!mapStateLicense[key].licenseNo}" styleClass="inputLicenseNo" onchange="checkChange()" onClick="clearThis();" style="width:63px!important;text-align:center;"/>                </apex:column>
                <apex:column headerValue="Licensed Since">
                    <apex:inputText id="licenseSince" value="{!mapStateLicense[key].licensedSince}" styleClass="inputLicensedSince" onchange="checkChange()" onClick="clearThis();" onFocus="DatePicker.pickDate(true, this, false);" style="width:100px;text-align:center;"/>
                </apex:column>
                <apex:column headerValue="Expiration">
                    <apex:inputText id="expiration" value="{!mapStateLicense[key].expiration}" styleClass="inputExpiration" onchange="checkChange()" onClick="clearThis();" onFocus="DatePicker.pickDate(true, this, false);" style="width:68px!important;text-align:center;"/>
                </apex:column> 
                <apex:column headerValue="Type">
                    <apex:inputText title="{!mapStateLicense[key].type}" value="{!mapStateLicense[key].type}" styleClass="inputType" onchange="checkChange()" onClick="clearThis();" style="width:126px!important;text-align:center; display:inline; word-wrap:break-word!important;"/>
                </apex:column>
                <apex:column headerValue="YTD Contract Value Completed">
                    <apex:inputText value="{!mapStateLicense[key].ytdContact}" onchange="checkChange()" styleClass="inputYTDContact" onClick="clearThis();" style="width:115px!important;text-align:center;"/>
                </apex:column>                        
            </apex:pageBlockTable>
           <apex:messages id="apexError" styleClass="message" style="margin-bottom: -29px!important;"/>
            <div class="errorMessages" style="margin: 9px 0 -20px -7px!important;font-size: 12px !important;"> </div>
            <br/><br/>
            <apex:outputLabel value="Year Registered with Nexius" style="font-size: 13px;font-weight:bold;">
                <apex:inputText value="{!currentYear}" style="width: 45px !important;font-weight: bold;text-align: center;position: absolute\9;margin-top: -2px\9 !important; margin-left: 8px\9 !important;" disabled="true" size="4" onchange="checkChange()" onClick="clearThis();" />
            </apex:outputLabel>
            
           
            <apex:pageBlockTable value="{!mapPriorContracts}" var="key" id="contract" styleClass="priorContractTable" columnsWidth="100px,92px, 92px, 111px !important">
                <apex:column headerValue="Contract Value" value="{!mapPriorContracts[key].state}"/>
                <apex:column headerValue="YTD">
                    <apex:inputText value="{!mapPriorContracts[key].yearToDate}" styleClass="inputYTD" onchange="checkChange()" onClick="clearThis();" style="text-align:center; width:62px!important;"/>
                </apex:column>
                <apex:column headerValue="Last Year">
                    <apex:inputText id="lastYear" value="{!mapPriorContracts[key].lastYear}" styleClass="inputLastYr" onchange="checkChange()" onClick="clearThis();" style="text-align:center; width:59px!important;"/>
                </apex:column> 
                <apex:column headerValue="Two Years Ago">
                    <apex:inputText value="{!mapPriorContracts[key].twoYearsAgo}" styleClass="inputTwoYrsAgo" onchange="checkChange()" onClick="clearThis();" style="text-align:center; width:84px!important;"/>
                </apex:column>
                <apex:column headerValue="Work Description">
                    <apex:inputText title="{!mapPriorContracts[key].workDescription}" styleClass="inputDescription" onchange="checkChange()" onClick="clearThis();" value="{!mapPriorContracts[key].workDescription}" style="text-align:center; width:221px!important;" />
                </apex:column> 
            </apex:pageBlockTable>
</apex:repeat>
I need to create a button where in after clicking it the user can create an additional table.

Please help.
SonamSonam (Salesforce Developers) 
Hi Dominic,

The following thread talks about getting addition row in an existing table with sample code on the post:
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000963NIAQ