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

Reload set to true on remote view with a datasource throws error on 2nd visit

1 Answer 50 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alex Smith
Top achievements
Rank 1
Alex Smith asked on 04 Nov 2013, 09:39 PM
I am trying to put together a view that should be reloaded (all data refreshed from the server) each time it is visited. Each time the page is loaded I intend for a datasource to be created and set on the page's view model. Now, what I have (an example is attached) works on the first view. Subsequent views always throw this exception:
Uncaught TypeError: Cannot call method 'closest' of undefined
from the kendo.mobile.min.js file.

I have tried the approach outlined here: http://www.kendoui.com/forums/kendo-ui-mobile/general-discussions/destroy-totally-remove-a-view-if-possible.aspx to completely destroy and remove the view from the DOM but I get the same error. So there must be some problem with the datasource. In the example I have attached the data source's data is from an array. My real intention is to use a datasource to fetch data from a remote endpoint (the URL of which will change each time the view is visited).

Please take a look at my example and tell me what is wrong or suggest an alternative way to get the behavior I'm looking for.

Thanks

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 06 Nov 2013, 07:55 AM
Hello Alex,

the reload view setting is suitable for the case when a new set of data is rendered on the server-side each time a certain view is requested. Since you are going to reload the data via dataSource/MVVM binding, you don't actually need it. You can perform the necessary view model update in the view show event handler.

Regards,
Petyo
Telerik
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
Alex Smith
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or