You need to sign in to do that
Don't have an account?
Dave Berenato
Apex Repeat to Show A List of Tables
I want to create a Visualforce page that displays a set of repeating tables (2 cells x 2 cells each).
How do you reference the Controller in the Apex Page to repeat so that each table shows one record?
Apex Class:
How do you reference the Controller in the Apex Page to repeat so that each table shows one record?
Apex Class:
public class Repeat1 { public List<pba_Listing__c> ListingFields {get;set;} public GetData() { [Select Name, pba_Status__c From pba_Listing__c WHERE pba_Status__c = 'Active' or pba_Status__c = 'Hold Short Sale' or pba_Status__c = 'Hold Standard Sale']; } }Visualforce page:
<apex:page Controller="Repeat1" recordSetVar="a1"> <apex:pageBlock title="Listing"> <apex:repeat> <apex:pageBlockTable value="{!a1}" var="a"> <table> <tr> <th>Name</th> <th><apex:outputField value="{!a.Name}"/></th> </tr> <tr> <td>Status</td> <td><apex:outputField value="{!a.pba_Status__c}"/></td> </tr> </table> </apex:pageBlockTable> </apex:repeat> </apex:pageBlock> </apex:page>
Controller:
You need to apply thestyling to the html table as you need though. Hope it Helps.
Please do not forget to mark this thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.
Best,
Nithesh
All Answers
Controller:
You need to apply thestyling to the html table as you need though. Hope it Helps.
Please do not forget to mark this thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.
Best,
Nithesh
I have a follow up question for this repeat table.
I moved the repeat table to an Apex PageBlockSection, and I'm getting an issues with the <apex: inputfield> function. It's taking up multiple cells in the table and throwing off the code entirely.
So imagine the original code but with editable fields instead of just Read Only fields:
But the entire table gets thrown off because Apex: input field and it no longer makes a 2 x 2 cell table.
Any ideas?
Please do not forget to mark this thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.
Best,
Nithesh