You need to sign in to do that
Don't have an account?
병훈 송
How to development pagination in custom controller
My Visualforce Page Code is
and My Custom Controller Code is
I want make the search campaign page in 2 functions
First, Result was pagination
Second, Searched result about keyword.
How to development pagination in custom controller?
Maybe I write Pagination Code on custon controller? but I don't know make it..
Can you help me?
<apex:page standardController="Campaign" recordSetVar="contacts" extensions="Campaign1"> <apex:form > <apex:pageBlock title="Campaign Search"> <h2>Name : </h2> <apex:inputText label="SearchName" value="{!searchName}"/> <apex:commandButton value="Search" action="{!searchbox}"> </apex:commandButton> </apex:pageBlock> <apex:pageBlock title="Campaign Detail"> </apex:pageBlock> <apex:pageBlock title="Contacts List" id="contacts_list"> <apex:pageBlockTable value="{! campaigns}" var="ct"> <apex:column value="{! ct.Name }"/> <apex:column value="{! ct.Type }"/> </apex:pageBlockTable> <table style="width: 100%"><tr> <td> Page: <apex:outputText value=" {!PageNumber} of {! CEILING(ResultSize / PageSize) }"/> </td> <td align="center"> <apex:commandLink action="{! Previous }" value="« Previous" rendered="{! HasPrevious }"/> <apex:outputText style="color: #ccc;" value="« Previous" rendered="{! NOT(HasPrevious) }"/> <apex:commandLink action="{! Next }" value="Next »" rendered="{! HasNext }"/> <apex:outputText style="color: #ccc;" value="Next »" rendered="{! NOT(HasNext) }"/> </td> <td align="right"> Records per page: <apex:selectList value="{! PageSize }" size="1" > <apex:selectOption itemValue="5" itemLabel="5"/> <apex:selectOption itemValue="20" itemLabel="20"/> <apex:actionSupport event="onchange" reRender="contacts_list"/> </apex:selectList> </td> </tr></table> </apex:pageBlock> </apex:form> </apex:page>
and My Custom Controller Code is
public class Campaign1 { public Campaign1(ApexPages.StandardSetController controller) { } public string searchName {get;set;} public list < Campaign> campaigns{get;set;} public Campaign c {get;set;} public Campaign1(apexPages.standardController con) { c = (Campaign)con.getRecord(); campaigns= new list <Campaign> (); campaigns= [select ID, Name, StartDate, EndDate, Type from Campaign]; } public void searchbox() { campaigns= new list <Campaign> (); String name = '%' + searchName + '%'; campaigns= [select ID, Name, StartDate, EndDate, Type from Campaign where Name Like :name]; } }
I want make the search campaign page in 2 functions
First, Result was pagination
Second, Searched result about keyword.
How to development pagination in custom controller?
Maybe I write Pagination Code on custon controller? but I don't know make it..
Can you help me?
Link for the guide: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/apex_pages_standardsetcontroller.htm
Thanks,
PSM