You need to sign in to do that
Don't have an account?
passing list of objects to visualforce page in different format.
hi guys, i need some help.
i need to pass a list of objects from the apex class to visualforce page.
so far, after searching around, i can only find <apex:dataTable> and <apex:pageBlockTable> to display the objects in a table.
so for example:
public List<Contact> getContacts() {
contactObjs = [SELECT name, address, phone from Companies
where id = :System.currentPageReference().getParameters().get('id')];
return contactObjs;
}
then if i want to display it in a nice table i can easily use something like this:
<apex:pageBlock>
<apex:pageBlockTable value="{!Contacts}" var="con">
<apex:column value="{!con.name}" />
<apex:column value="{!con.address}" />
<apex:column value="{!con.phone}" />
</apex:pageBlockTable>
</apex:pageBlockTable>
but how if i want to display those objects like this:
name: qwer
address: qwer
phone: 123
name: asdf
address: asdf
phone 456
can anyone help me please? or tell me which documentation/pdf file should i read
thanks in advance.
Take a look at<apex:repeat>
<apex:pageBlock>
<apex:pageBlockTable value="{!Contacts}" var="con">
<apex:column>
name:{!con.name}<br/>
Address:{!con.address}<br/>
Phone:{!con.phone}<br/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
you both are champions!
thanks guys, much appreciate it.