Prevent initial request to get data

10 posts, 0 answers
  1. Paola
    Paola avatar
    11 posts
    Member since:
    Mar 2015

    Posted 29 Dec 2015 Link to this post

    Hi,

    according to what is written in this answer, binding a grid on initial page (or view) load using BindTo will prevent the Ajax request (if there is any data).
    IMHO, even if the there is no data, if I explicitly bind the grid, it should not make any other attempt to get the data.

    Anyway, how can I prevent the request even if there is no initial data?

    Thank you.

     

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 30 Dec 2015 Link to this post

    Hello Paola,

     

    Have you tried using the autoBind option, documented here:

     

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-autoBind

     

    Regards,
    Kiril Nikolov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Paola
    Paola avatar
    11 posts
    Member since:
    Mar 2015

    Posted 30 Dec 2015 in reply to Kiril Nikolov Link to this post

    I've tried setting Autobind(false) but I got "NotSupportedException: Cannot set AutoBind if widget is populated during initialization"

    My grid is configured to works in batch editing mode similar to what is shown in the demo.

    Thank you.

  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 04 Jan Link to this post

    Hello Paola,

     

    Thanks for the clarification.

     

    I have talked about this with the team and currently such scenario is not supported. Currently the Grid will fetch data if nothing is present in the model. We cannot change this behavior as it will be a breaking change for lots of other users.

     

    Regards,
    Kiril Nikolov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Paola
    Paola avatar
    11 posts
    Member since:
    Mar 2015

    Posted 04 Jan Link to this post

    >> Currently the Grid will fetch data if nothing is present in the model

    This is nonsense IMHO. The Kendo UI team should add an option to deal with this case, with a default value so to preserve backward compatibility.

    Can you suggest a immediate workaround, please? I have a view with 3 grids and I'd like to avoid 3 useless AJAX calls.

    Thank you.

  7. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 05 Jan Link to this post

    Hello Paola,

     

    You can submit this as a feature request on UserVoice, so that it is considered for implementation in a future release if it gets popular among the users. However we cannot make this change immediately as it will be breaking for multiple users.

    Currently we do not have a viable workaround for this behavior.

     

    Regards,
    Kiril Nikolov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Paola
    Paola avatar
    11 posts
    Member since:
    Mar 2015

    Posted 08 Jan Link to this post

    I think this change will not be a breaking one if you add an option with a default value to preveserve current behaviour.

    Anyway, I found a workaround and I like to share here for anyone who may need it.

    Just hook the "RequestStart" event of the datasource; in the handler, check the value of a hidden field containing the ID of the model and if it's zero (or any other default value, like an empty guid) and the request is "read" then cancel the request:

    1.function onRequestStart(e)
    2.{
    3.    if (e.type === "read" && $("#Id").val() === "0")
    4.    {
    5.        e.preventDefault();
    6.    }
    7.}

    This prevents the unnecessary server requests when the user wants to insert a new record but not if he wants to edit it.
  9. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 12 Jan Link to this post

    Hello Paola,

     

    Thanks for sharing the workaround.

     

    We will further consider adding an option for this scenario.

     

    Regards,
    Kiril Nikolov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  10. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 12 Jan Link to this post

    Hello Paola,

     

    Thanks for sharing the workaround.

     

    We will further consider adding an option for this scenario.

     

    Regards,
    Kiril Nikolov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  11. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 12 Jan Link to this post

    Hello Paola,

     

    Thanks for sharing the workaround.

     

    We will further consider adding an option for this scenario.

     

    Regards,
    Kiril Nikolov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET MVC is VS 2017 Ready