This is a migrated thread and some comments may be shown as answers.

endlessScroll for a ListView only works in one direction?

1 Answer 47 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 1
Don asked on 26 Apr 2013, 03:03 AM
I have a listView that has endlessScroll enabled: 

$('#MyListView').kendoMobileListView({
        dataSource: myRemoteDataSource,
        template: myTemplate,
        autoBind: false,
        endlessScroll: true,
        scrollTreshold: 30
    });

It is bound to a dataSource that gets its data from a remote source that has tens of thousands of records:

var myRemoteDataSource = new kendo.data.DataSource({
            pageSize: 10,
            serverPaging: true,
            transport: {
                read: {
                    url: 'http://myremotedata'
                },
                parameterMap: function (data, type) {
                    var startRow = ((data.page - 1) * data.pageSize) + 1;
 
                    return {
                        strow: startRow,
                        rpp: data.pageSize
                    };
                }
            },
            schema: {
                data: 'Data',
                total: 'Total'
            }
        });

This works fine when I start the listView from the *first* page because all the other pages come after it, so only endlessScrolling in the downward direction is necessary.  However, sometimes I need to start the listView on a specific page other than page 1:

myRemoteDataSource.query({ page: 45, pageSize: 10 });  // 45 is a random page.

Again, the data is displayed as expected in the listView and endlessScrolling in the downward direction works.  However, when I try to scroll up to see the records on the previous page (i.e. page 44), nothing happens.  Apparently, endlessScrolling only works in one direction (down), even though it seems it would be trivial for it to make a call to the dataSource to retrieve the previous page (up) just as it retrieves the next page (down).

In a nutshell, I need to be able to take a listView which is remotely bound to thousands of records and start from any page and endlessScroll in either direction.  This seems like it would be a pretty fundamental feature.  Is there a way to do this?

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Accepted
Petyo
Telerik team
answered on 29 Apr 2013, 07:48 AM
Hello Don,

I am afraid that such behavior is not available currently - the ListView component relies on the data being continuous, without the possibility of 'jumping' to a specified range while skipping. 

For our next release, we are re-constructing the endless scrolling implementation, so such scenario should be possible to be implemented.

All the best,
Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
Don
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or