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

Issue with ScrollView not updating after updates to a local data source

2 Answers 219 Views
ScrollView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Artie
Top achievements
Rank 1
Artie asked on 18 Jun 2015, 06:51 PM

We are using a ScrollView bound to a local data source that is configured to show multiple items per page.  I ran into an issue today where it looked like the ScrollView was not refreshing its contents after an item in the data source had been updated via .set().  However, I discovered purely by accident that if you scroll two pages to the right and then scroll back two pages to the left, the ScrollView will have magically picked up your changes and re-rendered the items.  I've put together a Fiddle that demonstrates this behavior:

http://jsfiddle.net/rmaezowx/

If you push the "Make Yellow" button, nothing seems to happen even though the data source has been properly updated.  If you then swipe from the right twice, and then to the left, you will see what I'm talking about.  This looks like a bug in the ScrollView, is there any other workaround besides re-setting the data source (I haven't tried this yet)? 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 22 Jun 2015, 01:44 PM
Hello Artie,

The behaviour occurs because unlike other Kendo UI widgets the ScrollView does not listen for the change event of the DataSource. As a result it does not automatically refresh when the data in the DataSource changes.

As a workaround you may call the scrollTo method

function makeYellow() {
    clientsDataSource.data()[0].set("Color", "yellow");
    $("#scrollview").getKendoMobileScrollView().scrollTo(0);
}


Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Artie
Top achievements
Rank 1
answered on 22 Jun 2015, 02:23 PM
That's exactly what I needed, thanks!
Tags
ScrollView (Mobile)
Asked by
Artie
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Artie
Top achievements
Rank 1
Share this question
or