We are trying to use Kendo DataSource object to create requests to our custom ActionResult
.
The ActionResult
receives the same type of parameters as KendoGrid
is sending.
We don't want to use KendoGrid
to display the data, we just need the filtering functionality of KendoDataSource
.
public ActionResult Search([DataSourceRequest] DataSourceRequest request)
{
var dbItems = _db.DataItems.ToDataSourceResult(request).Data;
return Json(dbItems, JsonRequestBehavior.AllowGet);
}
var dataSource = new kendo.data.DataSource({
serverSorting: true,
sort: { field: "DataItemName", dir: "desc" },
transport: {
read: {
type: "GET",
url: "/Home/Search"
}
},
});
dataSource.read();
What are we doing wrong?
PS: Setting the method to POST
makes no difference