<ejs-grid id="Grid" toolbar="@(new List<string>() { "Add", "Edit","Delete", "Update", "Cancel", "Search" })" allowPaging="true">
<e-data-manager url="/Home/UrlDatasource" adaptor="UrlAdaptor" insertUrl="/Home/Insert" updateUrl="/Home/Update" removeUrl="/Home/Remove1"></e-data-manager>
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings>
<e-grid-pagesettings pageCount="5"></e-grid-pagesettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" validationRules="@(new { required=true})" textAlign="Right" width="120"></e-grid-column>
. . . .
</e-grid-columns>
</ejs-grid> |
public ActionResult UrlDatasource([FromBody]ExtendedDataManager dm)
{
IEnumerable DataSource = orddata.ToList();
DataOperations operation = new DataOperations();
if (dm.Search != null && dm.Search.Count > 0)
{
DataSource = operation.PerformSearching(DataSource, dm.Search); //Search
}
if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
{
DataSource = operation.PerformSorting(DataSource, dm.Sorted);
}
if (dm.Where != null && dm.Where.Count > 0) //Filtering
{
DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
}
int count = DataSource.Cast<OrdersDetails>().Count();
if (dm.Skip != 0)
{
DataSource = operation.PerformSkip(DataSource, dm.Skip); //Paging
}
if (dm.Take != 0)
{
DataSource = operation.PerformTake(DataSource, dm.Take);
}
return Json(new { result = DataSource, count = count });
} |
<head>
</head> |
public class Employee1Details
{
public static List<Employee1Details> order = new List<Employee1Details>();
public Employee1Details()
{
}
public Employee1Details(int EmployeeId, string FirstName, string LastName, int ReportsTO)
{
this.EmployeeID = EmployeeId;
. . . . .
}
public static List<Employee1Details> GetAllRecords()
{
if (order.Count() == 0)
{
for (int i = 1; i < 2; i++)
{
order.Add(new Employee1Details(i + 0, "Nancy", "Davolio", i + 0));
. . . .
}
}
return order;
}
public int? EmployeeID { get; set; }
. . . .
} |