2

How i can display data column wise insise loop. My code is.

 <div align="center">
  <apex:repeat value="{!data}" var="data1">                      
    <apex:pageBlock >
    <apex:pageBlockTable value="{!data1.Attachments}" var="a">
       <apex:column >
  <apex:image url="{!$Resource.pdfimg}" width="100"height="100"style="margin:20px;"/> 
        </apex:column>                  
   </apex:pageBlockTable>            
  </apex:pageBlock>
  </apex:repeat>
  </div>

This code is displaying images as:

 image1
 image2
 image3

I want to display as-

image1 image2 image3

How i can achieve this.

2

You can use apex:repeat instead of pageBlockTable and put your images to the html table:

<apex:repeat value="{!data}" var="data1">
    <table border="0">
    <tr>
    <apex:repeat value="{!data1.Attachments}" var="a">  
        <td>
        <apex:image url="{!$Resource.pdfimg}" width="100"height="100"style="margin:20px;"/> 
        </td>
    </apex:repeat>
    </tr>
    </table>
</apex:repeat>
| improve this answer | |
  • The table tags should be outside the repeat tags for proper display of multi-dimensional arrays. Otherwise you will get lots of tables, instead of just one. – Sander de Jong Sep 17 '18 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.