First action called on grid

2 posts, 0 answers
  1. Joel
    Joel avatar
    1 posts
    Member since:
    Sep 2011

    Posted 26 Feb 2013 Link to this post

    Am I correct in saying that the grid calls the Read operation on its datasource by default?  I am looking at some examples and I can't see where there is an explicit call to read the data from the datasource.  If I am right, is there a way to prevent that and wait for the user to initiate the load?

    Thanks
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2284 posts

    Posted 26 Feb 2013 Link to this post

    Hello Joel,

    Yes, you are right that the Read operation of the dataSource is called by default. If you want to prevent it, you should set the AutoBind(false) option in the Grid configuration and invoke it manually when needed.

    E.g.

    @(Html.Kendo().Grid<ProductViewModel>()   
        .Name("Grid")
        .AutoBind(false)
        ...
    )

    var grid = $("#Grid").data("kendoGrid");
    grid.dataSource.read();

      Kind regards,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top