I am referring below link for custom pagination for next & previous , but would like to know how first and Last page navigation will work. Any help is appreciated. paginate a wrapper class

  • question is too broad and unclear. Please, specify more details
    – kurunve
    Aug 2, 2016 at 8:30
  • I have a list of custom object records which i am displaying it on pageblocktable . 2 fields are editable on the layout and rest other fields are displayed as readonly. I am displaying records with pagination using custom iterator . The reason for using custom iterator is to persists values between previous and next pages. Previous and Next are working fine with custom iterator Pagination. Now i want to implement first and last methods , so user can click on first and last button to directly go to the first/last pages
    – Pooja
    Aug 2, 2016 at 8:42
  • here is what i am using for Next
    – Pooja
    Aug 2, 2016 at 8:49

1 Answer 1


In the you are referring, there are two commandButton with value '|<' and '>|'. These value are for First Page and Last Page.

When you use setCon of type ApexPages.StandardSetController, There are predefined methods for 'Next', 'Previous', 'First' and 'Last'. Please follow this link for more details about using ApexPages.StandardSetController for pagination.

And In the case of custom iterator, First and Last method will work same as Next() method, Only you need to set your startIndex to '0' in the case of First() and in the case Last() set startIndex to = sizeOfYourList - pageSize - 1

  • Thansk Vivek, But i am using custom iterator , not standardsetcontroller , the reason is i want to persist chnaged records over pages. so my query is how can I implement first and last methods using custom iterator.
    – Pooja
    Aug 2, 2016 at 8:53
  • In that case, First and Last will work same as next() method, Only you need to set your startIndex to '0' in the case of First() and in the case Last() set startInsex to = sizeOfYourList - pageSize - 1 Aug 2, 2016 at 9:05
  • it didn't work, can you tell me what is wrong in below code.
    – Pooja
    Aug 2, 2016 at 10:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .