function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mecrin Luvis 1Mecrin Luvis 1 

Wrapper Class

Hi Guys,  
Please any one can explain,by using one date field,how to  display the list odf the records in  page block table by using wrapper class 
salesforce mesalesforce me
Hi check it once....
<apex:page standardController="Lead" extensions="opentasks" >
    <apex:form >
        <apex:pageBlock title="open Tasks" mode="edit" id="opnTsks"> 
            <apex:Messages />         
            <center><a href="https://ap1.salesforce.com/00T/e?who_id={!leadld}&retURL={!leadld}" target="_top"><button type="button">New Task</button></a>
                <apex:commandButton value="close" action="{!close}" rerender="opnTsks"/>
            </center>&nbsp;&nbsp;
            <apex:pageBlockTable value="{!listwrapper}" var="each" >
                <apex:column headerValue="Action">
                     <apex:inputCheckbox value="{!each.checked}"/>
                    &nbsp;|&nbsp;
                    <apex:outputlink value="/{!each.k.id}/e?retURL={!each.k.WhoId}" target="_top"> Edit </apex:outputlink>
                   </apex:column>
                <apex:column headerValue="Subject" value="{!each.k.Subject}"/>
                <apex:column headerValue="ActiveDate" value="{!each.k.ActivityDate}"/>
                <apex:column headerValue="Status" value="{!each.k.Status}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
     </apex:form> 
</apex:page>
 
public class opentasks {
    public List<OpenActivity> open{get;set;}
    public Id leadld{get;set;}
    public list<wrapperclass> listwrapper{get;set;}
   
    public opentasks(ApexPages.StandardController controller){
        leadld = ApexPages.CurrentPage().getparameters().get('id');
        list<task> open1 =new list<Task>(); 
        listwrapper = new list<wrapperclass>();
        list<lead>   le =[SELECT Name, (Select Id,Subject, WhoId, ActivityDate,Status, Priority, OwnerId FROM Tasks WHERE IsClosed=false) 
                            FROM Lead WHERE Id = :leadld];
        if(!le.isEmpty()){
            for(Task k:le[0].Tasks)
            {
                listwrapper.add(new Wrapperclass(k));
            }
        }
    }
    
    public class wrapperclass
    {
        public  boolean checked{get;set;}
        public Task k{get;set;}
        public Wrapperclass(Task k){
            this.k=k;
        }
    }
    public PageReference close()
    {   
        list<Task> listofopen=new list<Task>();
        if(!listwrapper.isEmpty()){
            for(Integer i=0; i < listwrapper.size();i++)
            {
                wrapperclass w = listwrapper[i];
                if(w.checked==true){
                    system.debug(w);
                    w.k.status='completed';
                    listofopen.add(w.k);
                    listwrapper.remove(i);
                }
            
            }
        }
        if(listofopen.isEmpty())
        {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Select atleast one column t'));
        }
        else{
            update listofopen;    
        }
        return null;
    }   
 }

 
Mecrin Luvis 1Mecrin Luvis 1
Hi Sir,

That what you sent me.... Its working. But mine requirement is..... I have created Date field on lead object. When i select the date from that field and click on search button,it will display the list of the records of that lead object.fromthat start date to end date.