You need to sign in to do that
Don't have an account?
Pagination for Custom List
Hello!
I am new to Apex / Visualforce, so will appreciate any help with the following. I have created a custom list using visual force to display all child accounts in a related list. I would like to repeat the same for Contacts of child accounts in the page for parent account.
Now, having done that, how do I implement pagination - if the number of contacts / child accounts is significant?
See my apex code below:
<apex:page standardController="Account" extensions="childAccount">
<style>
.fewerMore { display: none;}
</style>
<apex:form >
<apex:pageMessages />
<apex:detail relatedList="true"></apex:detail>
<apex:pageblock id="CustomList" title="Child Accounts" >
<apex:pageBlockTable value="{!acctz}" var="o" rendered="{!NOT(ISNULL(acctz))}">
<apex:column headerValue="Action" >
<apex:outputLink value="/{!o.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="color:blue; text-decoration:none">Edit</apex:outputLink>
</apex:column>
<apex:column headerValue="Name"> <apex:outputLink value="/{!o.id}">{!o.Name}</apex:outputLink> </apex:column>
<apex:column value="{!o.Address_Street__c}"/>
<apex:column value="{!o.Address_City__c}"/>
<apex:column value="{!o.Office__c}"/>
<apex:column value="{!o.Type}"/>
</apex:pageBlockTable>
<apex:outputLabel value="No records to display" rendered="{!(ISNULL(acctz))}"></apex:outputLabel>
</apex:pageblock>
</apex:form>
</apex:page>
public class childAccount {
private List<Account> acctz;
private Account acct;
public childAccount(ApexPages.StandardController controller) {
this.acct= (Account)controller.getRecord();
}
public List<Account> getAcctz()
{
Account act = [Select id FROM Account where id = :acct.id];
acctz = [Select id, Name, Address_Street__c, Address_City__c, Office__c, Type from Account where parentid = :act.id];
return acctz;
}
}
Cannot you not use Pagination in a StandardController?
HI ppiyush,
I have similar requirement for pagination for custom related list.Please tell me how you fixed this pagination issue.
Thanks