sf中标准的分页功能介绍

  世上本无事,庸人自扰之。我喜欢一个相对比较安静的环境去学习和工作,希望在一个掉一根针的声音都能够听到的环境中,但是有时候往往相反,一片嘈杂,我改变不了周围的环境,只能改变自己,其实这些都没有什么,也许是我内心就很嘈杂,使我听到一点点声音就感觉很烦躁。上善若水,心静则情静继而人静。

  言归正传:

  sf中标准的分页功能:

  sf有自己标准的分页功能,sf真是个功能相当完善的云端开发平台,其有好多自己标准的功能,今天我就根据自己的理解先介绍一下sf标准的分页功能的皮毛。

  

定义关联到前台的Contet值
public ConstructionMethod(){
    Contet=(List<letterInfo__c>) con.getRecords();
}
public ApexPages.StandardSetController con{
    get {
        if(con == null) {
            con = new ApexPages.StandardSetController(letterInfoList);
            // sets the number of records in each page set
            con.setPageSize(5);
        }
        return con;
     }
     set;
}     
List<letterInfo__c> Contet;
public List<letterInfo__c> getContet(){
    return (List<letterInfo__c>) con.getRecords();
}
// indicates whether there are more records after the current page set. public Boolean hasNext{ get { return con.getHasNext(); } set;
}
// indicates whether there are more records before the current page set. public Boolean hasPrevious{ get { return con.getHasPrevious(); } set; } // returns the page number of the current page set public Integer pageNumber{ get { return con.getPageNumber(); } set; } // returns the first page of records public void first(){ con.first(); } // returns the last page of records public void last(){ con.last(); } // returns the previous page of records public void previous(){ con.previous(); } // returns the next page of records public void next(){ con.next(); } // returns the PageReference of the original page, if known, or the home page. public void cancel(){ con.cancel(); } integer totalPage; public integer getTotalPage(){ return (integer)Math.ceil((double)letterRead.size()/5.00); }
原文地址:https://www.cnblogs.com/yuxin-555xt/p/sf_standardPaging.html