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

Grid datasource if no Read method you get http 400 errors

1 Answer 310 Views
Grid
This is a migrated thread and some comments may be shown as answers.
BitShift
Top achievements
Rank 1
Veteran
BitShift asked on 08 Jan 2020, 01:45 PM

While putting together my first app, I am loading a grid via javascript, populating the grid with Json data only after a number of other inputs are gathered from the user. While doing this, I omitted the .Read method on the datasource.  I was noticing http 400 errors everytime this page loaded.  Initially thought I was having issues with the Forgerytoken, but after trial-and-error, comparing to another sample page, I decided to stub in a .Read method and handler in the controller, and the http 400 errors stopped.  So I suppose my question is this - is a .Read method required, even if it will never be used?

 

See attached files, that show both screenshots of network traffic from the chrome debugger console.  Notice the last request in the stack in each case.

 

1 Answer, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 13 Jan 2020, 08:21 AM

Hi Randal,

In general, the Kendo UI Grid is configured to auto bind. What this actually does is that when it gets initialized, it would call the read() method of the data source. The data source would send an AJAX request based on the content that was set within the Read option. If you would like to disable this behavior, I can recommend setting the AutoBind option of the grid to false:

.AutoBind(false)

Since the logic for retrieving the data is not set on the server-side, you should disable the server operations of the data source. This is due to the fact when a user sorts or filters the grid, a request would be sent to get the sorted or filtered data:

.ServerOperation(false)

I hope you find this helpful.

 

Regards,
Tsvetomir
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
Tags
Grid
Asked by
BitShift
Top achievements
Rank 1
Veteran
Answers by
Tsvetomir
Telerik team
Share this question
or