• Hildegard Olsen
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hi all!
Pagination not working on Visualforce page.
Can someone please help?
Thanks!
<apex:page Controller="AccContact">
  <apex:form >
      
<apex:pageBlock mode="inlineEdit">
<apex:pageBlockButtons >
<apex:commandbutton value="Save" action="{!save1}" />
<apex:commandbutton value="Cancel" action="{!cancel}" immediate="true"/>
 
 <apex:commandButton value="<<" rerender="details" action="{!beginning}" disabled="{!prev}"/>
            <apex:commandButton value="<" rerender="details" action="{!previous}" disabled="{!prev}"/>
            <apex:commandButton value=">" rerender="details" action="{!next}" disabled="{!nxt}"/>
            <apex:commandButton value=">>" rerender="details" action="{!end}" disabled="{!nxt}"/>      

    
</apex:pageBlockButtons>
 

  <apex:pageBlockTable value="{!acclst}" var="a">
      
    
  
 <apex:column headerValue="Name">
  <apex:commandLink action="{!selacc}">
  <apex:param name="conlst" value="{!a.id}"/>
  <apex:outputText value="{!a.name}"/>
  </apex:commandlink>
  </apex:column>
      
  <!--accounts-->
   </apex:pageBlockTable>
    <apex:pageBlockTable value="{!accconts1}" var="a">
    <apex:column headerValue="Account Name" value="{!a.Name}"/>
        
    <!--contacts-->
   <apex:column headerValue="List contacts">
   <apex:pageBlockTable value="{!AccContacts}" var="c">
       
  <apex:column headerValue="Title">
  <apex:outputField value="{!c.title}">
      <apex:inlineEditSupport event="ondblclick"/>
     
      </apex:outputField>
  </apex:column>
  
     
       
  <apex:column headerValue="First Name">
  <apex:outputField value="{!c.firstname}">
      <apex:inlineEditSupport event="ondblclick"/>
      </apex:outputField>
  </apex:column>
       
  <apex:column headerValue="Last Name">
 <apex:outputField value="{!c.lastname}">
      <apex:inlineEditSupport event="ondblclick"/>
      </apex:outputField>
  </apex:column>
   
  <apex:column headerValue="Email">
  <apex:outputField value="{!c.email}">
      <apex:inlineEditSupport event="ondblclick"/>
      </apex:outputField>
  </apex:column>

  <apex:column headerValue="Birthdate">
 <apex:outputField value="{!c.birthdate}">
      <apex:inlineEditSupport event="ondblclick"/>
      </apex:outputField>
  </apex:column>
       

 </apex:pageBlockTable> <!-- End contact-->
 </apex:column>
 </apex:pageBlockTable><!--end account-->
  </apex:pageBlock>
         

  </apex:form>
</apex:page>
 
public with sharing class AccContact {
    
    
    private integer totalRecs = 0;     
    private integer index = 0;
    private integer blockSize = 2;      
    
    
    
    public list<contact> conlst { get; set; }
    public string getid {get; set;}    
    public list<account> accconts1 { get; set; }
    
    public List<Account> acclst { get; set; }
    
    public  AccContact (){
        acclst=[select id,name  from account ];
        system.debug(acclst);
        conlst= getAccContacts();
        totalRecs = [select count() from contact]; 
        
    } 
    
     public List<Contact> getAccContacts()
    {
        conlst=[select id,lastname,firstname,email,title,birthdate from contact where AccountId=: getId LIMIT :blockSize OFFSET :index ];
        return conlst;
    }
    
    
    public PageReference selacc() {
        getid=apexpages.currentpage().getparameters().get('conlst');
        accconts1=[select id,name,(select id,lastname,firstname,email,title,birthdate from contacts)  from account where id=:getid ];
        system.debug(accconts1);
        return null;
    }
    
    
    
   
    
    
    
    
    public void beginning()
    {
        index = 0;
    }
    
    public void previous()
    {
        index = index - blockSize;
    }
    
    public void next()
    {
        index = index + blockSize;
    }
    
    public void end()
    {
        index = totalrecs - math.mod(totalRecs,blockSize);
    }        
    
    public boolean getprev()
    {
        if(index == 0)
            return true;
        else
            return false;
    }  
    
    public boolean getnxt()
    {
        if((index + blockSize) > totalRecs)
            return true;
        else
            return false;
    }         
    
    
    public PageReference save1() {
        update conlst;
        PageReference page = new Pagereference('/apex/Mass_Update');
        page.setRedirect(true);
        return page;
        
        
    }
    public void cancel(){
        PageReference page = new Pagereference('/apex/Mass_Update');
        page.setRedirect(true);
    }
    
}


 
How to add inline edit to VF page and pagination function? (for Title,Email and Birthdate)

Thanks!
 
<apex:page Controller="AccContact">
  <apex:form >
      
      <apex:pageBlock >
  <apex:pageBlockTable value="{!acclst}" var="a">
      
   
 <apex:column headerValue="Name">
  <apex:commandLink action="{!selacc}">
  <apex:param name="conlst" value="{!a.id}"/>
  <apex:outputText value="{!a.name}"/>
  </apex:commandlink>
  </apex:column>
  <!--accounts-->
   </apex:pageBlockTable>
    <apex:pageBlockTable value="{!accconts1}" var="a">
    <apex:column headerValue="Account Name" value="{!a.Name}"/>
    <!--contacts-->
    <apex:column headerValue="List contacts">
   <apex:pageBlockTable value="{!a.contacts}" var="c">
       
          <apex:column headerValue="Title">
  <apex:outputText value="{!c.title}"></apex:outputText>
  </apex:column>
  
       
    <apex:column headerValue="First Name">
  <apex:outputText value="{!c.firstname}"></apex:outputText>
  </apex:column>
       
  <apex:column headerValue="Last Name">
  <apex:outputText value="{!c.lastname}"></apex:outputText>
  </apex:column>
   
   <apex:column headerValue="Email">
  <apex:outputText value="{!c.email}"></apex:outputText>
  </apex:column>

     <apex:column headerValue="Birthdate">
  <apex:outputText value="{!c.birthdate}"></apex:outputText>
  </apex:column>
       
  
 </apex:pageBlockTable> <!-- End contact-->
 </apex:column>
 </apex:pageBlockTable><!--end account-->
  </apex:pageBlock>
         

  </apex:form>
</apex:page>
 
public with sharing class AccContact {

    public list<contact> conlst { get; set; }

   // public contact c { get; set; }
   /* public  void getSelacc() {
    }*/

    public list<account> accconts1 { get; set; }

    public PageReference selacc() {
    string getid=apexpages.currentpage().getparameters().get('conlst');
         accconts1=[select id,name,(select id,lastname,firstname,email,title,birthdate from contacts)  from account where id=:getid ];
            system.debug(accconts1);
      return null;
    }


    public List<Account> acclst { get; set; }
   public  AccContact (){
     acclst=[select id,name  from account ];
     system.debug(acclst);
   
   }

}


       

 
How to add inline edit to VF page and pagination function? (for Title,Email and Birthdate)

Thanks!
 
<apex:page Controller="AccContact">
  <apex:form >
      
      <apex:pageBlock >
  <apex:pageBlockTable value="{!acclst}" var="a">
      
   
 <apex:column headerValue="Name">
  <apex:commandLink action="{!selacc}">
  <apex:param name="conlst" value="{!a.id}"/>
  <apex:outputText value="{!a.name}"/>
  </apex:commandlink>
  </apex:column>
  <!--accounts-->
   </apex:pageBlockTable>
    <apex:pageBlockTable value="{!accconts1}" var="a">
    <apex:column headerValue="Account Name" value="{!a.Name}"/>
    <!--contacts-->
    <apex:column headerValue="List contacts">
   <apex:pageBlockTable value="{!a.contacts}" var="c">
       
          <apex:column headerValue="Title">
  <apex:outputText value="{!c.title}"></apex:outputText>
  </apex:column>
  
       
    <apex:column headerValue="First Name">
  <apex:outputText value="{!c.firstname}"></apex:outputText>
  </apex:column>
       
  <apex:column headerValue="Last Name">
  <apex:outputText value="{!c.lastname}"></apex:outputText>
  </apex:column>
   
   <apex:column headerValue="Email">
  <apex:outputText value="{!c.email}"></apex:outputText>
  </apex:column>

     <apex:column headerValue="Birthdate">
  <apex:outputText value="{!c.birthdate}"></apex:outputText>
  </apex:column>
       
  
 </apex:pageBlockTable> <!-- End contact-->
 </apex:column>
 </apex:pageBlockTable><!--end account-->
  </apex:pageBlock>
         

  </apex:form>
</apex:page>
 
public with sharing class AccContact {

    public list<contact> conlst { get; set; }

   // public contact c { get; set; }
   /* public  void getSelacc() {
    }*/

    public list<account> accconts1 { get; set; }

    public PageReference selacc() {
    string getid=apexpages.currentpage().getparameters().get('conlst');
         accconts1=[select id,name,(select id,lastname,firstname,email,title,birthdate from contacts)  from account where id=:getid ];
            system.debug(accconts1);
      return null;
    }


    public List<Account> acclst { get; set; }
   public  AccContact (){
     acclst=[select id,name  from account ];
     system.debug(acclst);
   
   }

}