best way to implement endless scroll that ends with last item in datasource

2 posts, 0 answers
  1. Martin
    Martin avatar
    12 posts
    Member since:
    Mar 2008

    Posted 24 Jul 2012 Link to this post

    I have a datasource which could have any number of items, therefore the total of items will be unknown.  I would like to have a maximum of 10 items per page and would ideally like to scroll through these items using the endless scroll feature.  However, the endless scroll will continue to loop through the datasource items when the last item has been reached. 

    I would like to use the endless scroll feature until the last item has been displayed and then this stops.  I will therefore need to perform a check  and stop returning records after all items have been requested.  The problem is, I have no idea where to start with implementing this.  I am using PHP.  Can anyone advise?

    var DataSource = new{
         pageSize: 10,
          transport: {
              read: "data.php",
              dataType: "json",
         sort: { field: "created", dir: "desc" },                                        

                  dataSource: DataSource,
                  pullToRefresh: true,
                  appendOnRefresh: false,    
                  endlessScroll: true,
                  scrollTreshold: 30, //treshold in pixels                            
                  style: "inset",       
                  template: $("#list").text()

    I assume I need to use the serverPaging and page  attributes that are in the documentation but this does not give any examples that help.
  2. Georgi Krustev
    Georgi Krustev avatar
    3688 posts

    Posted 27 Jul 2012 Link to this post

    Hello Martin,

    Here is a quote of the answer, which I posted in the support thread opened on the same matter:

    Here is a simple test project (ASP.NET) which shows how the case is handled on the server. You can also check this thread, which provides other possible solution. Nevertheless we will try to provide a better handling of the "endless scrolling" scenario for the service pack of the KendoUI (scheduled for the mid of August). 

    I will suggest you also to continue our conversation in the support thread in order to avoid any duplications. 

    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top