|
<ejs-grid #grid [dataSource]='data' [allowFiltering] ='true' [allowPaging]='true'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' isPrimaryKey='true' width=120></e-column>
<e-column field='EmployeeID' headerText='Employee ID' width=150></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
. . . . .
</e-columns>
</ejs-grid> |
|
public IActionResult UrlDatasource([FromBody]Data dm)
{
var order = OrdersDetails.GetAllRecords();
var Data = order.ToList();
int count = order.Count();
if (dm.where != null && dm.where.Count > 0 && dm.where[0].predicates != null)
{
for (var i = 0; i < dm.where[0].predicates.Count; i++)
{
switch (dm.where[0].predicates[i].field)
{
case "OrderID":
Data = (from cust in Data
select cust).ToList();
break;
. . . . .
}
count = Data.Count;
}
}
return dm.requiresCounts ? Json(new { result = Data.Skip(dm.skip).Take(dm.take), count = count }) : Json(Data); }
|