• Agent Comms 7
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 11
    Replies
Hi All,
I have created a Vf with  pagination , I want to show page number (Current Page Number/Total Page Numbers) ,so User should be able to navigate to any page by entering page number, 
here is my code..

vf page..

<apex:page controller="LeadPaginate" > <apex:pageMessages ></apex:pageMessages> <apex:pageBlock title="Hello !"> Here is your Document Lead List </apex:pageBlock> <apex:form id="myform"> <apex:pageblock id="pbId" > <apex:pageBlockSection columns="1" > <apex:pageblock > <apex:pageblockButtons location="Top"> <apex:commandButton value="Processed" action="{!clickMe}" /> </apex:pageblockButtons> <div align="right" id="div1"> <apex:outputPanel rendered="{!Setcon.hasPrevious}"> <apex:commandLink id="diableanchor" value="Previous" action="{!Setcon.Previous}" reRender="myform" /> &nbsp; &nbsp; </apex:outputPanel> <apex:outputPanel rendered="{!NOT(Setcon.hasPrevious)}" > <apex:commandLink id="diableanchor1" value="Previous" reRender="myform" style="color: #555555; cursor: default; text-decoration: none;"/> &nbsp; &nbsp; </apex:outputPanel> <apex:outputPanel rendered="{!Setcon.hasNext}"> <apex:commandLink value="Next" action="{!Setcon.Next}" reRender="myform" /> </apex:outputPanel> <apex:outputPanel rendered="{!NOT(Setcon.hasNext)}"> <apex:commandLink value="Next" reRender="myform" style="color: #555555; cursor: default; text-decoration: none;"/> </apex:outputPanel> </div> <apex:pageblocktable value="{!Contact}" var="cc" id="test" > <apex:column headerValue=""> <apex:inputCheckbox value="{!cc.bool}"/> </apex:column> <apex:column value="{!cc.con.Name}"/> <apex:column value="{!cc.con.Approval_Status__c }"/> </apex:pageblocktable> <apex:pageBlockButtons location="Bottom"> </apex:pageBlockButtons> <div align="right" id="div1"> <apex:outputPanel rendered="{!Setcon.hasPrevious}"> <apex:commandLink id="diableanchor2" value="Previous" action="{!Setcon.Previous}" reRender="myform" /> &nbsp; &nbsp; </apex:outputPanel> <apex:outputPanel rendered="{!NOT(Setcon.hasPrevious)}" > <apex:commandLink id="diableanchor3" value="Previous" reRender="myform" style="color: #555555; cursor: default; text-decoration: none;"/> &nbsp; &nbsp; </apex:outputPanel> <apex:outputPanel rendered="{!Setcon.hasNext}"> <apex:commandLink value="Next" action="{!Setcon.Next}" reRender="myform" /> </apex:outputPanel> <apex:outputPanel rendered="{!NOT(Setcon.hasNext)}"> <apex:commandLink value="Next" reRender="myform" style="color: #555555; cursor: default; text-decoration: none;"/> </apex:outputPanel> </div> <apex:actionFunction name="refreshPageSize" action="{!refreshPageSize}" status="fetchStatus" reRender="pbId"/> <apex:selectList value="{!size}" multiselect="false" size="1" onchange="refreshPageSize();"> <apex:selectOptions value="{!ContactsTables}"/> </apex:selectList> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText> </apex:pageblock> <apex:pageBlock > <apex:outputPanel rendered="{!display}"> <apex:pageblocktable value="{!selectedList}" var="w" columns="2" > <apex:column value="{!w.Name}"/> <apex:column value="{!w.Approval_Status__c }"/> </apex:pageblocktable> </apex:outputPanel> </apex:pageblock> </apex:pageBlockSection> </apex:pageblock> </apex:form> </apex:page>

controller...

Public class LeadPaginate{
 
    public Integer size { get; set; }
    Public List<WrapperContactWrapper> wrapperlist;
    Public Integer noOfRecords{get; set;}
    Map <id,Lead> SelectedcontactMap = new Map <id,Lead>();
    public boolean display{get;set;}
    public list<Lead> selectedList {get;set;}
    public List<SelectOption> ContactsTables{get;set;}
 
    Public class WrapperContactWrapper {
        Public Lead con{get;set;}
        Public boolean bool{get;set;}
        public WrapperContactWrapper(Lead c,boolean bool) {
            this.con = c; 
            this.bool = bool;
        }
    }
    public LeadPaginate(){
        size=3;

        ContactsTables= new List<SelectOption>();
        
        ContactsTables.add(new SelectOption('10','10'));
        ContactsTables.add(new SelectOption('20','20'));

        ContactsTables.add(new SelectOption('50','50'));

        ContactsTables.add(new SelectOption('100','100'));
        ContactsTables.add(new SelectOption('200','200'));

    }
 public ApexPages.StandardSetController Setcon {
        get { if(Setcon == Null) {
            Setcon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id , Name,CreatedDate,Approval_Status__c  from Lead where Approval_Status__c = 'Approved' limit 100 ]));
     
            setCon.setpagesize(size);
            noOfRecords = setCon.getResultSize(); }
            return Setcon;
        }
        set;
    }
    public PageReference refreshPageSize() {
         Setcon.setPageSize(size);
         return null;
    }
   Public List<WrapperContactWrapper> getContact() {
        getSelectedContact();
        wrapperlist = new List <WrapperContactWrapper>();
         
        for(Lead cc : (List<Lead>)Setcon.getRecords()) {
            if( SelectedcontactMap .ContainsKey(cc.id)) {
                wrapperlist.add (new WrapperContactWrapper(cc,true));
            } else {
            wrapperlist.add(new WrapperContactWrapper(cc,false));
            }
        }
        return wrapperlist;
    }
     
    public void getSelectedContact(){
        if(wrapperlist!=null) {
            for(WrapperContactWrapper wr:wrapperlist) {
                if(wr.bool == true) {
                    SelectedcontactMap.put(wr.con.id,wr.con);
                } else {
                    SelectedcontactMap.remove(wr.con.id);     
                }     
            }
       }
    }
    
    public void clickMe() {
        display = true;
        getSelectedContact();
        selectedList = SelectedcontactMap.values();
        wrapperlist = null;
        SelectedcontactMap.clear();
        getContact();
}
     
    public integer pageNumber {
        get {
            return Setcon.getPageNumber();
        }
        set;
    }
    
}

please give me some solution,
Need some help with the Command Link. I know there's no attribute as "Disable" for <apex:commandLink >, like we do have for <apex:commandButton> . But as per the requirement, i want to have the link disabled for a particular page. Can this be achived??
my code-
<apex:commandButton value="Previous" action="{!Setcon.Previous}" disabled="{!NOT(Setcon.hasPrevious)}" reRender="myform" />
<apex:commandButton value="Next" action="{!Setcon.Next}" disabled="{!NOT(Setcon.hasNext)}" reRender="myform" />
how i will use commandLink ?
i have built a pagination for wrapper class,my requirement is after clicking the next link the previous link will activate , similarly when i will be on last page the next link will be deactivate.


my controller:-

    public with sharing class acc_controller {
    
    public  List<Account> accList{get;set;}
    public  List<AccWrapper> accWrapList{get;set;}
    public  List<AccWrapper> accWrapList2{get;set;}
    public  List<AccWrapper> accWrapList3{get;set;}
    
    //public Integer cust_limit{get;set;}
    public  Integer cust_offset{get;set;}
    public  Integer cust_fixed_offset{get;set;}
    public  Boolean showFinalResult{get;set;}
    
    public Class AccWrapper
    {
        public Account acc{get;set;}
        public Boolean flag{get;set;}
        public AccWrapper(Account acc)
        {
            this.acc=acc;
            this.flag=false;
        }
    }
        public acc_controller(ApexPages.StandardController controller) {
            
        //cust_limit=1;
        showFinalResult=false;
        cust_fixed_offset=2;
        cust_offset=0;
        accList=new List<Account>();
        accWrapList=new List<AccWrapper>();
        accWrapList2=new List<AccWrapper>();
        accList=[select id,name from account limit 100];
        
        Integer count=0;
        for(Account accObj:accList)
        {
            accWrapList.add(new AccWrapper(accObj));
            if(count<cust_fixed_offset)
            {
            accWrapList2.add(new AccWrapper(accObj));
            count++;
            }
            
        }
    }
    
    
    
    public void saveList()
    {
        
        for(AccWrapper accWrapObj1:accWrapList)
        {
            for(AccWrapper accWrapObj2:accWrapList2)
            {
                if(accWrapObj2.acc.Id==accWrapObj1.acc.Id)
                {
                   accWrapObj1.flag=accWrapObj2.flag; 
                }
            }
        }
    }
    
    public  void next()
    {
        accWrapList2=new List<AccWrapper>();
        
        cust_offset+=cust_fixed_offset; 
        if(cust_offset>accWrapList.size()-1)
        {
            cust_offset=accWrapList.size()-1;
            
        }
        Integer counter=0;
        for(Integer i=cust_offset;i<accWrapList.size();i++)
        {
            if(counter<cust_fixed_offset)
            {
             accWrapList2.add(accWrapList[i]);
             counter++;
            }
            else
            {
            break;
            }
            
        }
       
    }
    
    
    public  void previous()
    {
        accWrapList2=new List<AccWrapper>();
        cust_offset-=cust_fixed_offset;
        if(cust_offset<1)
        {
            cust_offset=0;
            
        }
        Integer counter=0;
        for(Integer i=cust_offset;i<accWrapList.size();i++)
        {
            if(counter<cust_fixed_offset)
            {
             accWrapList2.add(accWrapList[i]);
             counter++;
            }
            else
            {
            break;
            }
            
        }
            
    
    }
    
    public void first()
    {
    }
    
    public void last()
    {
    }
    
    public void Process()
    {
         
         accWrapList3=new List<AccWrapper>();
         for(AccWrapper accWrapObj1:accWrapList)
         {
             if(accWrapObj1.flag)
             {
             accWrapList3.add(accWrapObj1);
             }
         }
         showFinalResult=true;
        
    }

}

myVfpage:-

<apex:page standardController="Account" extensions="acc_controller">
<apex:form >
<apex:actionstatus startText="processing..." id="statusBar"></apex:actionstatus>
<apex:pageblock >
<!--<apex:commandLink value="First"/>-->
     <apex:commandLink value="Next" reRender="pTable" status="statusBar" action="{!next}"/>&nbsp;&nbsp;
     <apex:commandLink value="Previous" reRender="pTable" status="statusBar" action="{!previous}"/>
     <!--<apex:commandLink value="Last"/>     -->
     
     
     <apex:commandbutton value="Process" action="{!Process}" rerender="finalResult" status="statusBar"/>
     <apex:outputPanel id="pTable">
     <apex:pageblockTable value="{!accWrapList2}" var="a" >
     <apex:column headerValue="Select">
         <apex:inputCheckbox value="{!a.flag}">
         <apex:actionSupport event="onclick" rerender="pTable" status="statusBar" action="{!saveList}"/>
         </apex:inputCheckbox>
     </apex:column>
     <apex:column value="{!a.acc.name}"/>
     
     </apex:pageblockTable>
     
     </apex:outputPanel>
     
     <!--<apex:commandLink value="First"/>-->
     <apex:commandLink value="Next" reRender="pTable" status="statusBar" action="{!next}"/>&nbsp;&nbsp;
     <apex:commandLink value="Previous" reRender="pTable" status="statusBar" action="{!previous}"/>
     <!--<apex:commandLink value="Last"/>     -->
     
     <apex:pageblock >
     <apex:outputPanel id="finalResult">
     <apex:pageBlockTable value="{!accWrapList3}" var="ac" rendered="{!showFinalResult}">
     <apex:column value="{!ac.acc.name}"/>
     </apex:pageBlockTable>
     </apex:outputPanel>
         
     </apex:pageblock>
     
 </apex:pageblock>
</apex:form>
</apex:page>



please help me...
please run this code and please share the solution.
i am new to salesforce and this requirement is in high priority.
Hi..I have a input date field in a vfpage where I have used a datepicker. When I select a date from here and the page somehow gets refreshed it shows error-
""Value 'Sat Jan 30 00:00:00 GMT 2016' cannot be converted from Text to com.force.swag.soap.DateOnlyWrapper""
Can anyone tell me why this error is coming
I have created a custom web to case form. on click of submit button a case record is created in the org and user is redirected to a thanks page. I want to display the case number of the created case on that thanks page. Both the pages have different controllers. Can anyone tell what to do for that?
When a i am creating a case request at the same time i want to autopopulate account and contact lookup field on the case.
i have built a pagination for wrapper class,my requirement is after clicking the next link the previous link will activate , similarly when i will be on last page the next link will be deactivate.


my controller:-

    public with sharing class acc_controller {
    
    public  List<Account> accList{get;set;}
    public  List<AccWrapper> accWrapList{get;set;}
    public  List<AccWrapper> accWrapList2{get;set;}
    public  List<AccWrapper> accWrapList3{get;set;}
    
    //public Integer cust_limit{get;set;}
    public  Integer cust_offset{get;set;}
    public  Integer cust_fixed_offset{get;set;}
    public  Boolean showFinalResult{get;set;}
    
    public Class AccWrapper
    {
        public Account acc{get;set;}
        public Boolean flag{get;set;}
        public AccWrapper(Account acc)
        {
            this.acc=acc;
            this.flag=false;
        }
    }
        public acc_controller(ApexPages.StandardController controller) {
            
        //cust_limit=1;
        showFinalResult=false;
        cust_fixed_offset=2;
        cust_offset=0;
        accList=new List<Account>();
        accWrapList=new List<AccWrapper>();
        accWrapList2=new List<AccWrapper>();
        accList=[select id,name from account limit 100];
        
        Integer count=0;
        for(Account accObj:accList)
        {
            accWrapList.add(new AccWrapper(accObj));
            if(count<cust_fixed_offset)
            {
            accWrapList2.add(new AccWrapper(accObj));
            count++;
            }
            
        }
    }
    
    
    
    public void saveList()
    {
        
        for(AccWrapper accWrapObj1:accWrapList)
        {
            for(AccWrapper accWrapObj2:accWrapList2)
            {
                if(accWrapObj2.acc.Id==accWrapObj1.acc.Id)
                {
                   accWrapObj1.flag=accWrapObj2.flag; 
                }
            }
        }
    }
    
    public  void next()
    {
        accWrapList2=new List<AccWrapper>();
        
        cust_offset+=cust_fixed_offset; 
        if(cust_offset>accWrapList.size()-1)
        {
            cust_offset=accWrapList.size()-1;
            
        }
        Integer counter=0;
        for(Integer i=cust_offset;i<accWrapList.size();i++)
        {
            if(counter<cust_fixed_offset)
            {
             accWrapList2.add(accWrapList[i]);
             counter++;
            }
            else
            {
            break;
            }
            
        }
       
    }
    
    
    public  void previous()
    {
        accWrapList2=new List<AccWrapper>();
        cust_offset-=cust_fixed_offset;
        if(cust_offset<1)
        {
            cust_offset=0;
            
        }
        Integer counter=0;
        for(Integer i=cust_offset;i<accWrapList.size();i++)
        {
            if(counter<cust_fixed_offset)
            {
             accWrapList2.add(accWrapList[i]);
             counter++;
            }
            else
            {
            break;
            }
            
        }
            
    
    }
    
    public void first()
    {
    }
    
    public void last()
    {
    }
    
    public void Process()
    {
         
         accWrapList3=new List<AccWrapper>();
         for(AccWrapper accWrapObj1:accWrapList)
         {
             if(accWrapObj1.flag)
             {
             accWrapList3.add(accWrapObj1);
             }
         }
         showFinalResult=true;
        
    }

}

myVfpage:-

<apex:page standardController="Account" extensions="acc_controller">
<apex:form >
<apex:actionstatus startText="processing..." id="statusBar"></apex:actionstatus>
<apex:pageblock >
<!--<apex:commandLink value="First"/>-->
     <apex:commandLink value="Next" reRender="pTable" status="statusBar" action="{!next}"/>&nbsp;&nbsp;
     <apex:commandLink value="Previous" reRender="pTable" status="statusBar" action="{!previous}"/>
     <!--<apex:commandLink value="Last"/>     -->
     
     
     <apex:commandbutton value="Process" action="{!Process}" rerender="finalResult" status="statusBar"/>
     <apex:outputPanel id="pTable">
     <apex:pageblockTable value="{!accWrapList2}" var="a" >
     <apex:column headerValue="Select">
         <apex:inputCheckbox value="{!a.flag}">
         <apex:actionSupport event="onclick" rerender="pTable" status="statusBar" action="{!saveList}"/>
         </apex:inputCheckbox>
     </apex:column>
     <apex:column value="{!a.acc.name}"/>
     
     </apex:pageblockTable>
     
     </apex:outputPanel>
     
     <!--<apex:commandLink value="First"/>-->
     <apex:commandLink value="Next" reRender="pTable" status="statusBar" action="{!next}"/>&nbsp;&nbsp;
     <apex:commandLink value="Previous" reRender="pTable" status="statusBar" action="{!previous}"/>
     <!--<apex:commandLink value="Last"/>     -->
     
     <apex:pageblock >
     <apex:outputPanel id="finalResult">
     <apex:pageBlockTable value="{!accWrapList3}" var="ac" rendered="{!showFinalResult}">
     <apex:column value="{!ac.acc.name}"/>
     </apex:pageBlockTable>
     </apex:outputPanel>
         
     </apex:pageblock>
     
 </apex:pageblock>
</apex:form>
</apex:page>



please help me...
please run this code and please share the solution.
i am new to salesforce and this requirement is in high priority.
I have created a custom web to case form. on click of submit button a case record is created in the org and user is redirected to a thanks page. I want to display the case number of the created case on that thanks page. Both the pages have different controllers. Can anyone tell what to do for that?
I need to be able to drop and drop row within a table in Visualforce, can anyone give a pointer on how to implement this functionality. I use "pageBlockTable" component. I tried using custom JavaScript but not able to get to  <TR> from what "pageBlockTable" generates. Thanks in advance.