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
Varun AnnadataVarun Annadata 

How to display more than 2 columns in apex:repeat

How to display more than 2 columns properly in apex:repeat tag with equal spacing
Best Answer chosen by Varun Annadata
Akshay_DhimanAkshay_Dhiman
Hi  Varun,
Try this Code
<apex:page standardController="Account" recordSetVar="Accounts">
   <style>
       th{ width: 25%;}       
   </style>
    <apex:form >
      <html>
        <body>
          <table  width="100%" border="2">  
             <tr>
                <th>Colomn One</th>
                <th>Colomn Two</th>
                <th>Colomn Three</th>
                <th>Colomn four</th>
             </tr>
              <apex:repeat value="{!Accounts}" var="ac">
              <tr>
                  <td> {!ac.id}</td>          
                  <td> {!ac.Name}</td>
                  <td> {!ac.Type}</td>
                  <td> {!ac.AccountNumber}</td>
              </tr> 
              </apex:repeat>
           </table>
          </body>
        </html>
</apex:form>  
</apex:page>

Here are the output result.
User-added image

Regards,
Akshay
If this answers your query please mark this question as a solved so that it can be filtered out from unsolved questions.

All Answers

Samadhan ForceSamadhan Force
Hi Varun,

try to post what exactly you are doing,

repeaters dont have any restriction on displaying data.

Thanks
SamadhanForce
Akshay_DhimanAkshay_Dhiman
Hi  Varun,
Try this Code
<apex:page standardController="Account" recordSetVar="Accounts">
   <style>
       th{ width: 25%;}       
   </style>
    <apex:form >
      <html>
        <body>
          <table  width="100%" border="2">  
             <tr>
                <th>Colomn One</th>
                <th>Colomn Two</th>
                <th>Colomn Three</th>
                <th>Colomn four</th>
             </tr>
              <apex:repeat value="{!Accounts}" var="ac">
              <tr>
                  <td> {!ac.id}</td>          
                  <td> {!ac.Name}</td>
                  <td> {!ac.Type}</td>
                  <td> {!ac.AccountNumber}</td>
              </tr> 
              </apex:repeat>
           </table>
          </body>
        </html>
</apex:form>  
</apex:page>

Here are the output result.
User-added image

Regards,
Akshay
If this answers your query please mark this question as a solved so that it can be filtered out from unsolved questions.
This was selected as the best answer
Akshay_DhimanAkshay_Dhiman
Hi Varun,

Thanks for selecting my answer as a best. It's my pleasure to help you!

Regards,
Akshay