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

DataType json 2 calls

3 Answers 133 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 01 Jul 2016, 05:29 PM

Asking for clarification on dataType: "json". In an example I created at http://dojo.telerik.com/AQEpe, when I run the code the debugger will display only one call to the customers api if I just list the URL in the transport read section. But when I add dataType: "json" as a property below the url and run the code the datasource will be retrieved twice now as shown in the debugger. 

The Callback1.png displays the first method with no dataType and only one call to the api. Callback2.png displays the second method described with a datatype and two calls to the api. 

Should I not include dataType: "json" in my code for shared calls? Is including dataType necessary at all? I am trying to limit the calls to the database and in my application the filters similar to the example are creating duplicate calls slowing the page.

3 Answers, 1 is accepted

Sort by
0
Accepted
Boyan Dimitrov
Telerik team
answered on 05 Jul 2016, 09:04 AM

Hello David,

When the Kendo UI MultiSelect does not have autoBind property set to false the MultiSelect widget will force the DataSource to send a read request. This might cause to unexpected behavior when multiple widgets share same DataSource instance. 

As mentioned in the autoBind help article setting autoBind to false is useful when multiple widgets are bound to the same data source. Disabling automatic binding ensures that the shared data source doesn't make more than one request to the remote service.

Please refer to the http://dojo.telerik.com/AQEpe/2 example. 

Regards,
Boyan Dimitrov
Telerik
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Courtney
Top achievements
Rank 1
answered on 11 Aug 2016, 11:20 PM

Hi Boyan,

 

I looked at your example however it doesn't work - did you check?  After you filter back on one multi-select - all multi-selects are limited to only having the first filtered result - what's the point of this as it can't share a datasource?

I'm guessing sharing a datasource is something Kendo doesn't yet support although has probably been on a wish list for the last few years.......

 

0
Boyan Dimitrov
Telerik team
answered on 15 Aug 2016, 02:51 PM

Hello Courtney,

The main purpose of the example is to show that autoBind:false will avoid sending multiple requests to the server when more than one widget does share same DataSource instance. We do support shared DataSource, but if automatic binding is enabled this might cause unexpected behavior. This is caused because all widgets will request their data at pretty much same time. At the time when the second widget requests its data the response from the first request is not received yet and the DataSource might initiate another request. 

Regards,
Boyan Dimitrov
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Data Source
Asked by
David
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Courtney
Top achievements
Rank 1
Share this question
or