You need to sign in to do that
Don't have an account?
John T 4
Display data from multiple objects in a VF page in one pageblocktable
I have a requirement to display records from 2 objects (Account & Contact) in a single pageblocktable in a VF page, Account records followed by Contact records.
I know that we can achieve this using a wrapper class, but all the examples I came across talked about displaying checkbox or displaying columns vertically(not horizontally) from different objects in a pageblocktable.
Would appriciate any pointers/code samples. Thanks!!
I know that we can achieve this using a wrapper class, but all the examples I came across talked about displaying checkbox or displaying columns vertically(not horizontally) from different objects in a pageblocktable.
Would appriciate any pointers/code samples. Thanks!!
Object
Name
Phone
Email.
You will have to loop through the query results of the account object and cast the query results into this wrapper object and add them to a list.
After this, you will have to write another loop where you iterate through the contact object results and cast the query results into a wrapper object and add them to the same list.
You can then use that list in a pageblocktable in VF to display the combined query results. Give it a try and post your code below, we can work on refining it.