You need to sign in to do that
Don't have an account?
shoba shoba
pageblocktable pagination with wrapper class
Hi I want to show the pagination for the wrapper class for the below code. Can anyone help me out how to solve this.
public class opentasks { public List<Contact> open{get;set;} public Id Accld{get;set;} //public set<string> st; public list<Account> le{get;set;} public list<wrapperclass> listwrapper{get;set;} Public boolean refreshpage{get;set;} public opentasks(ApexPages.StandardController controller){ Accld = ApexPages.CurrentPage().getparameters().get('id'); list<Contact> open1 =new list<Contact>(); listwrapper = new list<wrapperclass>(); le =[SELECT Id,BillingState,BillingCountry,BillingStreet,BillingCity,BillingPostalCode, (Select Id,Email,MailingState,MailingStreet,MailingCountry,MailingCity,Contact_Type__c,MailingPostalCode FROM Contacts ) FROM Account WHERE Id =:Accld]; if(!le.isEmpty()){ for(Contact k: le[0].Contacts) { listwrapper.add(new Wrapperclass(k)); } } } public class wrapperclass { public boolean checked{get;set;} public Contact k{get;set;} public Wrapperclass(Contact k){ this.k=k; } } public PageReference Updates() { list<Contact> listofopen=new list<Contact>(); if(!listwrapper.isEmpty()){ for(Integer i=0; i<listwrapper.size();i++) { wrapperclass w = listwrapper[i]; if(w.checked==true){ system.debug(w); w.k.MailingCountry=le[0].BillingCountry; w.k.MailingStreet=le[0].BillingStreet; w.k.MailingCity=le[0].BillingCity; w.k.MailingState=le[0].BillingState; w.k.MailingPostalCode=le[0].BillingPostalCode; listofopen.add(w.k); //listwrapper.remove(i); //i--; update listofopen; } } } if(listofopen.isEmpty()) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Select atleast one column ')); } return null; } public PageReference UpdatesAll() { list<Contact> listofopen1=new list<Contact>(); for(Integer i=0; i<listwrapper.size();i++) { wrapperclass w = listwrapper[i]; if(!listwrapper.isEmpty()){ system.debug(w); w.k.MailingCountry=le[0].BillingCountry; w.k.MailingStreet=le[0].BillingStreet; w.k.MailingCity=le[0].BillingCity; w.k.MailingState=le[0].BillingState; w.k.MailingPostalCode=le[0].BillingPostalCode; listofopen1.add(w.k); //listwrapper.remove(i); // i--; update listofopen1; } } return null; } } VisualForce Page: <apex:page standardController="Account" extensions="opentasks" > <apex:form > <apex:pageBlock title="Contacts" mode="edit" id="opnTsks" > <apex:Messages /> <apex:pageblockButtons location="Top" > <apex:commandButton value="Update" action="{!Updates}" id="opnTsks"/> <apex:commandButton value="UpdateAll" action="{!UpdatesAll}" /> </apex:pageblockButtons> <apex:pageBlockTable value="{!listwrapper}" var="each" > <apex:column headerValue="Action"> <apex:inputCheckbox value="{!each.checked}"/> </apex:column> <apex:column headerValue="MailingCountry" value="{!each.k.MailingCountry}"/> <apex:column headerValue="MailingStreet" value="{!each.k.MailingStreet}"/> <apex:column headerValue="MailingCity" value="{!each.k.MailingCity}"/> <apex:column headerValue="MailingState" value="{!each.k.MailingState}"/> <apex:column headerValue="MailingPostalCode" value="{!each.k.MailingPostalCode}"/> </apex:pageBlockTable> <apex:outputPanel id="refresh" rendered="true"> <apex:outputPanel id="refresh1" rendered="{!refreshPage}"> </apex:outputPanel> </apex:outputPanel> </apex:PageBlock> </apex:form> </apex:page>Thanks In Advance
1) http://amitsalesforce.blogspot.in/2014/11/pagination-with-wrapper-class-with.html
Let us know if this will help you
Thanks
Amit Chaudhary