+ Start a Discussion

Extracting Field values column wise in a table

I need to  get all feild values of rows in the columns of a table i.e as table heading.



can anybody esnd code to do this via a simple table or datatable or pageblock table etc..







<!-- For this example to render properly, you must associate the Visualforce page 

with a valid account record in the URL.

For example, if 001D000000IRt53 is the account ID, the resulting URL should be:


See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->

<!-- Page: -->

<apex:page controller="dataTableCon" id="thePage">

<apex:dataTable value="{!accounts}" var="account" id="theTable" rowClasses="odd,even"


<apex:facet name="caption">table caption</apex:facet>

<apex:facet name="header">table header</apex:facet>

<apex:facet name="footer">table footer</apex:facet>


<apex:facet name="header">Name</apex:facet>

<apex:facet name="footer">column footer</apex:facet>

<apex:outputText value="{!account.name}"/>



<apex:facet name="header">Owner</apex:facet>

<apex:facet name="footer">column footer</apex:facet>

<apex:outputText value="{!account.owner.name}"/>




/*** Controller: ***/

public class dataTableCon {

List<Account> accounts;

public List<Account> getAccounts() {

if(accounts == null) accounts = [select name, owner.name from account limit 10];

return accounts;