You need to sign in to do that
Don't have an account?
Rockers
How to populate collection of data on visualforce pages..
Hi,
I have List Collection type on one object. Now, i want to print those values of object one by one on a visual force page.
how, could i place record by record (say.,
1st record
2nd record
3rd record..........)
Thanks in advance........
There are a few ways you can do this--to answer your questions more specifically I'd need some more details, but here's a simple way to do it:
1. Identify the list of data you want to iterate through. As an example, lets pretend we have an account, and we'll grab the list of contacts off of it.
Now the list you want to iterate through is the collection of contacts on this account.
2. Iterate over your data in a pageblock table
In visual force, you can reference this list in several elements--one of my favorites is <apex: pageBlockTable>
Visualforce will do the wotk for you here. If you have 5 items in the list, you'll get 5 rows each with 3 columns (first name, last name, email). Note that the "value" attribute refers to the list we want to display. You can replace that value with whatever refers to the list of data you want to iterate through.
If your needs are different, you can also take a look at <apex: dataTable> or <apex: dataList>
Hope that helps!