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

DataSource read called twice

2 Answers 331 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Jesse
Top achievements
Rank 1
Jesse asked on 25 Jul 2014, 08:00 PM
Hello,

The datasource read method is called twice when the contents are displayed on UI. Please refer to the attached file for code details.

Thanks for  your time and help.

2 Answers, 1 is accepted

Sort by
0
Jesse
Top achievements
Rank 1
answered on 28 Jul 2014, 02:30 PM
Missing file attached.
0
Alexander Valchev
Telerik team
answered on 29 Jul 2014, 11:13 AM
Hello Jesse,

Is this the full source code of the page? There is no obvious reason for the read transport to be triggered twice - the dataSourceInvitations is not used anywhere except in the document.ready event handler. Is there a widget bound to this dataSource? If your aim is to just retrieve a remote JSON data once and render a template with it I would recommend you to use standard jQuery.ajax request. For example:
$.ajax({
    url: "http://localhost:8080/NavXzy/rest/SecurityService/getNotifications?emailAddress=ab@bc.ca",
    type: "GET",
    dataType: "json",
    success: function(response) {
        //render the template
    }
});

On a side note, I would recommend to re-consider the application structure as the current approach is error prone because:

- Kendo UI Mobile applications does not support dynamically HTML replacement
- In Kendo UI Mobile applications MVVM binding should be performed via data-model property, nut by calling kendo.bind manually
- The JavaScript initialization of the widgets should be put inside the init event handler of the parent View

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Data Source
Asked by
Jesse
Top achievements
Rank 1
Answers by
Jesse
Top achievements
Rank 1
Alexander Valchev
Telerik team
Share this question
or