0

We have a simple implementation, utilizing a standard controller and RecordSetVal to pass selected records from a list view to a PDF output. It appears by default the records sort by RecordName. I don't see a way to re-order via the standard controller (preferably by the List View sort). Any input?

To clarify, I know we can write a custom controller to reorder and pass back to the visualforce output, but I'd like to use the standard controller if there's a way to do so.

<apex:page standardController="Payment__c"
       renderAs="pdf"
       readOnly="true"
       standardStylesheets="false"
       showHeader="false"
       applyHtmlTag="false"
       applyBodyTag="false"
       docType="html-5.0"
       recordSetVar="payments">
<html>
    <head>
        <style>
            * {margin: 0px; padding: 0px; border: 0px; outline: 0px; font-size: 100%; vertical-align: baseline; background: transparent;}               
            body {border: 0px; margin: 0px; padding: 0px; outline: 0px; font-family: 'monospace'; font-size: 12pt; text-align: left, top;}
            table  {font-family: 'monospace'; font-size: 12pt;  text-align: left, top;}
            th  {font-family: 'monospace'; font-size: 12pt; text-align: left, top;}
            td  {font-family: 'monospace'; font-size: 12pt; text-align: left, top;}
            tr {height: 0.20in;}
            @page {margin-left: 0.22in; margin-top: 0.29in;}
        </style>
    </head>
    <body>
        <apex:pageBlock >
            <apex:repeat value="{!selected}" var="p">
<!-- Check body -->            
                <div style="page-break-after:auto; page-break-inside:avoid; font-family:Monospaced; font-size: 12pt; text-align: left,top;">
<!-- Check Header-->
                    <table>
                        <tr style="height:0.50in;">
                            <td></td>
                        </tr></table>

<!-- Check Payment Date-->  
                    <table>
                        <tr>
                            <td style="width:6.75in;"></td>
                            <td><apex:outputText value="{0,date, MM'/'d'/'yyyy}"><apex:param value="{!p.Payment_Date__c}"/></apex:outputText></td>
                        </tr></table>

<!-- Check Spacer -->
                    <table>
                        <tr style="height:0.20in;">
                            <td></td>
                        </tr></table>

<!-- Check Payee and Amount -->
                    <table>
                        <tr>
                            <td style="width:0.79in;"></td>                
                            <td style="width:5.51in;">{!p.Organization__r.Name}</td>
                            <td style="width:0.80in;"></td>
                            <td><apex:outputtext value="{0,number,#,###,###.00}"><apex:param value="{!p.Paid_Amount__c}"/></apex:outputtext></td>
                        </tr></table>

<!-- Check Spacer-->
                    <table>
                        <tr style="height:0.05in;">
                            <td></td>
                        </tr></table>                    

<!-- Check Check Amount In Words -->
                    <table>
                        <tr>
                            <td style="width:0.08in;"></td>
                            <td style="width:6.93in;">{!p.Check_Amount_Words__c}</td>
                        </tr></table>

<!-- Check Spacer-->
                    <table>
                        <tr style="height:0.8in;">
                            <td></td>
                        </tr></table>

<!-- Check 8 Memo-->
                    <table><tr>
                        <td style="width:57px;"></td>
                        <td style="width:432px;">{!p.Check_Memo__c}</td>
                        </tr></table><br/>

<!-- Check Tearoff  -->
<!-- Tearoff Header-->
                    <table>
                        <tr style="height:1.0in;">
                            <td></td>
                        </tr></table>

<!-- Check Program Area-->
                    <table>
                        <tr>
                            <td>{!p.Organization__r.Type}</td>
                        </tr></table>

<!-- Check Spacer -->
                    <table>
                        <tr style="height:0.20in;">
                            <td></td>
                        </tr></table>

<!-- Tearoff Payment Date-->    
                    <table>
                        <tr>
                            <td style="width:6.75in;"></td>
                            <td><apex:outputText value="{0,date, MM'/'d'/'yyyy}"><apex:param value="{!p.Payment_Date__c}"/></apex:outputText></td>
                        </tr></table>

<!-- Tearoff Spacer -->
                    <table>
                        <tr style="height:0.25in;">
                            <td></td>
                        </tr></table>

<!-- Tearoff Payee and Amount -->
                    <table>
                        <tr>
                            <td style="width:0.79in;"></td>                
                            <td style="width:5.51in;">{!p.Organization__r.Name}</td>
                            <td style="width:0.80in;"></td>
                            <td><apex:outputtext value="{0,number,#,###,###.00}"><apex:param value="{!p.Paid_Amount__c}"/></apex:outputtext></td>
                        </tr></table>

<!-- Tearoff Spacer-->
                    <table>
                        <tr style="height:0.05in;">
                            <td></td>
                        </tr></table>

<!-- Tearoff Check Amount In Words -->
                    <table>
                        <tr>
                            <td style="width:0.08in;"></td>
                            <td style="width:6.93in;">{!p.Check_Amount_Words__c}</td>
                        </tr></table>

<!-- Tearoff Spacer-->
                        <table>
                            <tr style="height:0.10in;">
                                <td></td>
                        </tr></table>

<!-- Tearoff Notes-->
                    <table>
                        <tr>
                            <td style="width:57px;"></td>
                            <td style="width:432px;">{!p.Payment_Notes__c}</td>
                        </tr></table>

<!-- Tearoff Spacer-->
                    <table>
                        <tr style="height:.10px;">
                            <td></td>
                        </tr></table>

<!-- Tearoff RequestID-->
                    <table>
                        <tr style="height:16px;">
                            <td style="width:189px;">{!p.Name}</td>
                        </tr></table>

<!-- Tearoff Footer--> 
                    <table>
                        <tr style="height:19px;">
                            <td></td>
                        </tr></table>
                </div>                  
            </apex:repeat>
        </apex:pageBlock>       
    </body>
</html>
</apex:page>
  • Are you using renderAs="pdf", or are you loading an HTML page with some kind of link/button that then passes it into a PDF? – caleb.breckon Mar 7 at 15:22
  • Excellent question. We have a List Button on the object that calls a Visualforce page. I've added the actual code to the original post. – HomerJ Mar 7 at 15:26
  • 2
    look at the second option ipfs-sec.stackexchange.cloudflare-ipfs.com/salesforce/A/… -- assumes you can pass a listView id as part of the URL to this page. You could define a listview that is pre-sorted as you would like – cropredy Mar 7 at 16:35

Your Answer

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

Browse other questions tagged or ask your own question.