You need to sign in to do that
Don't have an account?
smitra
Displaying SOQL query result in VF page tablular form
Please let me know how to display the SOQL query result in VF page in tabular form when the SOQL object type and the associated attributes are dynamic.
http://forceguru.blogspot.in/2012/11/page-block-table-with-dynamic-columns.html
All Answers
http://forceguru.blogspot.in/2012/11/page-block-table-with-dynamic-columns.html
Apex controller code:
public class tableviewcontroller
{
public List<Account> acclist {get;set;}
public tableviewcontroller()
{
acclist=[select id,Name,Phone,Fax from Account];
}
}
Visualforce page code:
<apex:page controller="tableviewcontroller">
<style>
.Tabletitle
{
background-color: #179dae !important;
font-size:13px;
}
td
{
padding:4px 1px 2px 2px;
}
</style>
<apex:dataTable value="{!acclist}" var="A" rules="rows">
<apex:column headerValue="ID" headerClass="Tabletitle" width="240">
<apex:outputField value="{!A.ID}"/>
</apex:column>
<apex:column headerValue="Name" headerClass="Tabletitle" width="240" >
<apex:outputLabel>{!A.Name}</apex:outputLabel>
</apex:column>
<apex:column headerValue="Phone" headerClass="Tabletitle" width="240">
<apex:outputLabel>{!A.Phone}</apex:outputLabel>
</apex:column>
<apex:column headerValue="Fax" headerClass="Tabletitle" width="240">
<apex:outputLabel>{!A.Fax}</apex:outputLabel>
</apex:column>
</apex:dataTable>
</apex:page>