locked
Pagination in Listview RRS feed

  • Question

  • User71087 posted

    Hi all, I have nearly 1000 records in my ListView I need to show 100 records in each page. Can any one please help me on how to add Pagination in ListView. Any sample code or proper link on how to implemented will be very helpful!!

    Thank you.

    Tuesday, July 7, 2020 5:30 AM

Answers

  • User371688 posted

    If the 1000 records in your backend server, you can use request 100 records in one time, when you scroll to the next page, you can request the 101- 100 items for the next page. But you need to make sure the rest api will return only 100 records in a single api call just as ASfendYar said.

    There are nice tutorials on how to achieve this:

    http://motzcod.es/post/107620279512/load-more-items-at-end-of-listview-in

    https://github.com/jguibault/Xamarin-Forms-Infinite-Scroll

    https://github.com/CarlosHSantos/XamarinMarvelApp

    And there is a similar thread about this, you can check it here: https://stackoverflow.com/questions/43102069/xamarin-forms-listview-load-more

    Hope it can help you.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, July 7, 2020 7:53 AM

All replies

  • User198968 posted

    To implement the pagination you have to involve the backend along with the front end. First of all make sure your rest api will return only 100 records in a single api call and then bind those records with your xamarin forms listview control. Then inside your xamarin forms listview when you scroll the listview and if the listview scroll approaches near the 100 record then call the rest api and ask for another hundred record.

    Tuesday, July 7, 2020 7:25 AM
  • User371688 posted

    If the 1000 records in your backend server, you can use request 100 records in one time, when you scroll to the next page, you can request the 101- 100 items for the next page. But you need to make sure the rest api will return only 100 records in a single api call just as ASfendYar said.

    There are nice tutorials on how to achieve this:

    http://motzcod.es/post/107620279512/load-more-items-at-end-of-listview-in

    https://github.com/jguibault/Xamarin-Forms-Infinite-Scroll

    https://github.com/CarlosHSantos/XamarinMarvelApp

    And there is a similar thread about this, you can check it here: https://stackoverflow.com/questions/43102069/xamarin-forms-listview-load-more

    Hope it can help you.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, July 7, 2020 7:53 AM
  • User71087 posted

    thanks for your help @AsfendYar @jezh

    Tuesday, July 7, 2020 8:09 AM
  • User371688 posted

    Hi @A_V, If these answers are useful for you, could you please mark this thread so that others who have similar question will get help from here? Thanks in advance. :)

    Friday, July 10, 2020 2:51 AM