DataType json 2 calls

4 posts, 1 answers
  1. David
    David avatar
    16 posts
    Member since:
    Aug 2014

    Posted 01 Jul Link to this post

    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.

  2. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 05 Jul Link to this post

    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.
     
  3. Kendo UI is VS 2017 Ready
  4. Courtney
    Courtney avatar
    3 posts
    Member since:
    Jan 2012

    Posted 11 Aug in reply to Boyan Dimitrov Link to this post

    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.......

     

  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 15 Aug Link to this post

    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.
     
Back to Top
Kendo UI is VS 2017 Ready