'DataSourceResult does not make paging, filtering and sorting in kendo-grid
I've read this tutorial and it says that
Use the
ToDataSourceResult
extension method to convert yourIQueryable
orIEnumerable
to aKendo.UI.DataSourceResult
object. This extension method will page, filter, sort, or group your data using the information provided by the DataSourceRequest object.
So my code looks like this:
var parkDataTable = new DataTable("tmp");
SqlCommand cmd = null;
SqlDataReader dr = null;
using (DbContextTransaction transaction = db.Database.BeginTransaction())
try {
cmd = new SqlCommand("FooStoredProcedure", db.Database.Connection as SqlConnection,
transaction.UnderlyingTransaction as SqlTransaction);
cmd.CommandType = CommandType.StoredProcedure;
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
parkDataTable.Load(dr);
return parkDataTable.AsEnumerable().Select(x => x.Table).FirstOrDefault()
.ToDataSourceResult(request);
}
finally{
dr?.Close();
cmd?.Dispose();
}
So I've converted to IEnumerable
, but filtering, paging or sorting cannot be done at kendo-grid
of Angular 2
application.
Could you clarify what am I doing wrong?
My kendo-grid
table does not have paging, sorting, filtering:
Solution 1:[1]
The Grid needs to be sortable, pageable, filterable, etc. in order the respective UI to be present:
Furthermore, the request parameters need to be processed in a way that will make them understandable by the DataSourceRequest modelbinder:
You can check out the following integration guide for further details and a sample project:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | topalkata |