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 two list properly in one table side by side in vf page?

<apex:page standardcontroller="Program_Member_MVN__c" extensions="ProgramMemberCaseAttachment" showHeader="false" >
 <head>
        <apex:includescript value="//code.jquery.com/jquery-1.11.1.min.js" / >
        <apex:includescript value="//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js" />
        <apex:stylesheet value="//cdn.datatables.net/1.10.4/css/jquery.dataTables.css" />
        <script>
            j$ = jQuery.noConflict();
            j$(document).ready( function () {
                var contactTable = j$('[id$="accounttable"]').DataTable({
                    
                });
            });
        </script>
 </head>
            <body>
            <table id="accounttable" class="display"  >
            <thead>
                <tr>
                    <th>Case Number/PM Number</th>
                    <th>Attachment</th>
                    <th>LastModifiedDate</th>
                    <th>CreatedBy</th>
                    <th>Description</th>
                </tr>
            </thead>
            <tbody>  
            
                <apex:repeat value="{!PMresults}" var="N"> 
                
                    <!--<apex:form>
                
                    <apex:pageBlock>
                
                    <apex:pageBlockTable value="{!PMTyperesults}" var="dimension2">
                    
                    <apex:column value="{!dimension2.Type__c}"/>
                    
                    </apex:pageBlockTable>
                    
                    </apex:pageBlock>
                    
                    </apex:form>-->
                
                    <tr>
                    
                    <td><apex:outputLink value="/{!N.ParentId}" target="_blank">{!N.Parent.Name}</apex:outputLink></td>     
                                         
                    <td><apex:outputLink value="{!URLFOR($Action.Attachment.Download,N.Id)}" target="_blank">{!N.Name}</apex:outputLink></td>
                    
                    <td>{!N.LastModifiedDate}</td>
                    
                    <td><apex:outputLink value="/{!N.CreatedById}" target="_blank">{!N.CreatedBy.Name}</apex:outputLink></td>
                    
                    <td>
                    <apex:outputField value="{!N.Description}"/></td>
                    
                    </tr>    
                                                                       
                </apex:repeat>
            </tbody>
            </table>
            </body>
</apex:page>
This is my visual force page.

My apex class:
public class ProgramMemberCaseAttachment{
    public List<Attachment> PMresults{get;set;}
    
    public List<Attachment_Type__c> PMTyperesults{get;set;}
    
    public Program_Member_MVN__c cs;
    
    public ProgramMemberCaseAttachment(ApexPages.StandardController controller)
    {
    cs=(Program_Member_MVN__c)controller.getRecord();
        
    List<case> Test = new List<case>([select id from case where Program_Member_MVN__c =: cs.id]);
    
    System.debug('Test:'+Test);
    
    PMresults = [select CreatedBy.Name,OwnerId,ParentId,Parent.Name,Id,Name,LastModifiedById,CreatedById,LastModifiedDate, Description from Attachment where parentid =: cs.id OR parentid IN:Test ];
    
    PMTyperesults = [select Type__c from Attachment_Type__c];

    }
}
I want to display the PMTyperesults also in my vfpage.How can i display two list in my repeat tag such that it displays as a single table?What is the best way to do this.PMTyperesults and PMresults are list of two different object.will wrapper class help?
Waqar Hussain SFWaqar Hussain SF
Yes, You can use wrapper class.