I have examined the provided code and noticed that the ActionMethod returns an object. However, dataSource.data
expects an array. In order to ensure that the data is returned in the correct format from the server you should use ToDataSourceResult when returning data. Please check out the article below that describes Ajax binding in more detail.
Furthermore, you should set the type
and specify the schema.data
property. This way the dataSource will know from what field in the response to read the data.
The snippets below show how the code would look after the modifications. Give the approach a try and let me know how the behavior changes.
ActionResult GetData([DataSourceRequest]DataSourceRequest request,
var months =
Json(months.Where(x => x == month).ToDataSourceResult(request));
In order to request the data for the Grid component you just need to call the read() method
. You can pass additional parameters as arguments and use that information in the Read Action. Note the month
argument in the previous snippet.
The code snippet below shows an example of how to call call read() with additional parameters.
var month =
The workaround you describe is doing something similar. It passes the parsed data directly to the dataSource.
Telerik by Progress