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

Grid generating an HttpPost at document ready

1 Answer 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 09 Jun 2013, 11:52 PM
Strange behaviour, really...
I have an ASP.NET MVC View with a form, and inside of it, a grid that I configure with code like:

@(Html.Kendo().Grid<Customer>()

            .Name("gridSecondaryCustomers")
            .Columns(columns =>
            {
                    ...

and then I bind it to local data (JavaScript array) with code like:

        var grid = $("#gridSecondaryCustomers").data("kendoGrid");
        localDataSource = new kendo.data.DataSource({ data: secondaryCustomers });
        grid.setDataSource(localDataSource);

Last, I add items by code in the array, and refresh the grid with previous code.

Nothing is showing, so I suppose that the problem lies in the 'normal' configuration of the grid, that tries to go to the server, or something like that...
So I add this code:

...
    .DataSource(ds => { ds.Ajax().ServerOperation(false); })

and now, magically, when I add an item to the array, I can see the grid populated correctly.

What puzzles me is that with this single line in the grid configuration, loading the page generates an HttpPost to the controller, that I cannot really track down to where it comes... :-(
Could you please help me? Please ask me for more information, if needed...
Thanks as always,
Andrea

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 10 Jun 2013, 05:50 AM
Hello Andrea,

I guess you are seeing the initial bind request due to  widget AutoBind setting. If you set it to false it will not attempt to retrieve data until forced (dataSource.read()).

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