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

Scrolling stops working when setting data source

2 Answers 141 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
RP Axio
Top achievements
Rank 1
RP Axio asked on 22 Nov 2012, 11:40 AM
We have a listview which is populated every 5 seconds with data from a database using AJAX. Normally everything works correctly, including scrolling. However if the user has their finger on the screen (listview) when we set the data source then for some reason scrolling no longer works even though the content of the listview is updated.

This only seems to be a problem with iOS.

Once the AJAX has completed we use the following code to set the data source.
$("#listView").data("kendoMobileListView").dataSource.data(data.Data);

Any thoughts on what might cause this?

2 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 28 Nov 2012, 10:21 AM
KendoUI have been able to reproduce the problem and are investigating.
0
David
Top achievements
Rank 1
answered on 13 Dec 2012, 01:57 PM
Work around from KendoUI. We omit scroller.reset() so the scroll bar position doesn't get reset.

Currently we can suggest a workaround that uses fake event to end the scrolling action. Please check this example.
In order to test it on your real project you should put the following code in the change event of the DataSource which will fire after ListView data is re-read.

var scroller = app.scroller();
var touches = scroller.userEvents.touches;
var dummyEvent = { event: { preventDefault: $.noop } };
 
for (var i = 0; i < touches.length; i ++) {
    touches[i].end(dummyEvent);
}
 
scroller.reset();
Tags
ListView (Mobile)
Asked by
RP Axio
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Share this question
or