You need to sign in to do that
Don't have an account?
Ashritha Reddy
page block table vs data table
what is the main usage ofapec page block table and data table can any one give me the examples?
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
An HTML table that is defined by iterating over a set of data, displaying information about one item of data per row. The body of the < apex:dataTable > contains one or more column components that specify what information should be displayed for each item of data. The data set can include up to 1,000 items.
Apex:pageBlockTable – A list of data displayed as a table within either an < apex:pageBlock > or < apex:pageBlockSection > component, similar to a related list or list view in a standard Salesforce page. Like an < apex:dataTable >, an < apex:pageBlockTable > is defined by iterating over a set of data, displaying information about one item of data per row. The set of data can contain up to 1,000 items.The body of the < apex:pageBlockTable > contains one or more column components that specify what information should be displayed for each item of data, similar to a table. Unlike the < apex:dataTable > component, the default styling for < apex:pageBlockTable > matches standard Salesforce styles. Any additional styles specified with < apex:pageBlockTable > attributes are appended to the standard Salesforce styles.
Apex:repeat – This tag is used as for loop(for list) in apex. You can iterate a list.
- -> there is no proper allignment of data in repeat as compared with datatable
Please check below post for code1) http://www.thephani.com/difference-between-pageblocktabe-datatable-repeat/
2) http://honeysalesforce.blogspot.in/2013/02/difference-between-pageblocktabledatata.html
Visualforce page:
<apex:page controller="sample" sidebar="false" >
<style type="text/css">
.outBorder
{
border:3px outset black;
}
.inBorder
{
border-top:3px dotted black;
border-left:3px dotted black;
}
</style>
<apex:pageBlock title="Pageblock Table">
<apex:pageblockTable value="{!acc}" var="a">
<apex:column value="{!a.Name}"/>
<apex:column value="{!a.Name}"/>
</apex:pageblockTable>
</apex:pageBlock>
<apex:pageBlock title="Data Table">
<apex:dataTable value="{!acc}" var="a" styleClass="outBorder" width="550px">
<apex:column styleClass="inBorder">
<apex:facet name="header">Account Name</apex:facet>
<apex:outputText >{!a.Name}</apex:outputText>
</apex:column>
<apex:column styleClass="inBorder">
<apex:facet name="header">Account Number</apex:facet>
<apex:outputText >{!a.AccountNumber}</apex:outputText>
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:page>
Apex Controller:
public with sharing class sample
{
public List<Account> acc {get;set;}
public sample()
{
acc = [SELECT Name, AccountNumber FROM Account];
}
}
Let us know if this will help you
All Answers
Find the Below Link:
https://developer.salesforce.com/forums/?id=906F00000008rVgIAI
Thanks,
Shiva
An HTML table that is defined by iterating over a set of data, displaying information about one item of data per row. The body of the < apex:dataTable > contains one or more column components that specify what information should be displayed for each item of data. The data set can include up to 1,000 items.
Apex:pageBlockTable – A list of data displayed as a table within either an < apex:pageBlock > or < apex:pageBlockSection > component, similar to a related list or list view in a standard Salesforce page. Like an < apex:dataTable >, an < apex:pageBlockTable > is defined by iterating over a set of data, displaying information about one item of data per row. The set of data can contain up to 1,000 items.The body of the < apex:pageBlockTable > contains one or more column components that specify what information should be displayed for each item of data, similar to a table. Unlike the < apex:dataTable > component, the default styling for < apex:pageBlockTable > matches standard Salesforce styles. Any additional styles specified with < apex:pageBlockTable > attributes are appended to the standard Salesforce styles.
Apex:repeat – This tag is used as for loop(for list) in apex. You can iterate a list.
- -> there is no proper allignment of data in repeat as compared with datatable
Please check below post for code1) http://www.thephani.com/difference-between-pageblocktabe-datatable-repeat/
2) http://honeysalesforce.blogspot.in/2013/02/difference-between-pageblocktabledatata.html
Visualforce page:
<apex:page controller="sample" sidebar="false" >
<style type="text/css">
.outBorder
{
border:3px outset black;
}
.inBorder
{
border-top:3px dotted black;
border-left:3px dotted black;
}
</style>
<apex:pageBlock title="Pageblock Table">
<apex:pageblockTable value="{!acc}" var="a">
<apex:column value="{!a.Name}"/>
<apex:column value="{!a.Name}"/>
</apex:pageblockTable>
</apex:pageBlock>
<apex:pageBlock title="Data Table">
<apex:dataTable value="{!acc}" var="a" styleClass="outBorder" width="550px">
<apex:column styleClass="inBorder">
<apex:facet name="header">Account Name</apex:facet>
<apex:outputText >{!a.Name}</apex:outputText>
</apex:column>
<apex:column styleClass="inBorder">
<apex:facet name="header">Account Number</apex:facet>
<apex:outputText >{!a.AccountNumber}</apex:outputText>
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:page>
Apex Controller:
public with sharing class sample
{
public List<Account> acc {get;set;}
public sample()
{
acc = [SELECT Name, AccountNumber FROM Account];
}
}
Let us know if this will help you