You need to sign in to do that
Don't have an account?
Sorting, Paging, and Ordering Custom Related Lists on an Account Page
I'm trying to setup a custom related list on the Account page that has sorting and pagination, but without losing too much of the standard functionality for the page.
So my questions are:
1. Is there a way to reorder the related lists so that the custom list is not at the bottom of all the others? I've tried moving it with javascript but when someone does inline editing then the related lists are rerendered without the custom list. I've also tried using <apex:relatedlist> tags for the other related lists, but then they do not hide/appear for the right page layouts/record types.
2. What's the easiest way to add sorting and pagination? The users would like to be able to click on a column and have it resort.
Visualforce Page
<apex:page standardcontroller="Account" extensions="AccountDetailController" tabStyle="Account" id="AccountPage">
<apex:detail id="detail" relatedListHover="false" inlineedit="true" />
<!-- Active Licenses --> <apex:pageblock title="Active Licenses" id="licenses" > <apex:facet name="header"> <table border="0" cellpadding="0" cellspacing="0" style="padding:0;border-bottom:none;"><tbody><tr> <td class="pbTitle"><img src="/img/icon/cd24.png" alt="License" class="relatedListIcon" style="width:24px; display:block; margin:-4px 4px -5px -8px;" title="License"/><h3 >Active Licenses</h3></td> <td class="pbButton"><input value="New License" title="New License" class="btn" onclick="window.location.href='{!URLFOR($Action.License__c.New, $ObjectType.License__c,['CF00Na000000A8Imu'=Account.Name,'CF00Na000000A8Imu_lkid'=Account.Id,'retURL'='/'+Account.Id])}';return false;" type="button" style="padding:2px 3px;"/></td> <td class="pbHelp"> </td> </tr></tbody></table> </apex:facet> <apex:pageblocktable title="Active Licenses" id="activelicenses" value="{!Licenses}" var="license" rendered="{!Licenses.size!=0}" > <apex:column headerValue="Name"> <apex:outputlink value="/{!License.Id}" target="_parent" ><apex:outputfield value="{!license.Name}"/></apex:outputlink> </apex:column> <apex:repeat value="{!$ObjectType.License__c.FieldSets.Account_Related_List}" var="f"> <apex:column value="{!license[f]}" /> </apex:repeat> </apex:pageblocktable> <apex:outputText rendered="{!Licenses.size = 0}" value="No records to display" style="padding:5px;border:1px solid #E0E3E5;display:block;" /> </apex:pageblock>
</apex:page>
Hi,
Please refer the following link that would help for your scenario,
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_sosc_pagination.htm
http://www.infallibletechie.com/2013/01/pagination-using-apex-in-salesforce.html
http://cloudforce4u.blogspot.in/2013/06/visualforce-component-for-pagination-in.html
http://hisrinu.wordpress.com/2012/01/09/pagination-using-standardsetcontroller/
Hope this will help you...!
Please give kudos and mark this as a solution, If you found this answer as useful to others as well.
Thank you, those are good examples of pagination. Has anyone done sorting and pagination in visualforce? It's unclear whether standardsetcontroller has issues with sorting to begin with.