Here is the SOQL to get the records -
Apex Class -
List<Vendor_Quote_Line_Item__c> vendorQuoteLineItems = [SELECT Id,
Product_Name__r.ProductCode,
Product_Name__r.Name,
FROM Vendor_Quote_Line_Item__c WHERE Vendor_Quote__r.Work_Order_ID__c = 'ID'];
Then I put the above vendorQuoteLineItems list as a page ref parameter like this -
PageReference pageRef = new PageReference('/apex/GeneratePDF');
pageRef.getParameters().put('vendorQuoteLineItems', JSON.serialize(vendorQuoteLineItems[0]));
Visual force -
On the visual force page I am trying to loop through the sobject records and list each item as a row in a table.
<apex:page>
<table style="border: 1px solid black; border-collapse: collapse; width: 100%; font-family: sans-serif;">
<thead>
<tr style="background-color: #f2f2f2;">
<th style="border: 1px solid black; padding: 5px;">Product Code</th>
<th style="border: 1px solid black; padding: 5px;">Product Name</th>
</tr>
</thead>
<tbody>
<apex:repeat value="{!$CurrentPage.parameters.vendorQuoteLineItems}" var="item">
<tr>
<td style="border: 1px solid black; padding: 5px;">{!item.Product_Name__r.Product_Code__c}</td>
<td style="border: 1px solid black; padding: 5px;">{!item.Product_Name__r.Name}</td>
</tr>
</apex:repeat>
</tbody>
</table>
</apex:page>
On the visual force page I am not setting any controller, everything on the page is displayed with the values from pageRef.
Except for the above I am displaying other values which are just single values not records and they work perfectly fine.
vendorQuoteLineItemsas a page parameter is just a string, theapex:repeat value="xx"expects an Object that is a list. You'll need a controller that does the soql; the pageParameter should be thework_order_id__c's value