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

2 posts, 0 answers
  1. Alex Smith
    Alex Smith avatar
    17 posts
    Member since:
    Dec 2009

    Posted 04 Nov 2013 Link to this post

    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
  2. Petyo
    Admin
    Petyo avatar
    2444 posts

    Posted 06 Nov 2013 Link to this post

    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!
Back to Top