@(Html.EJ().Grid<OrderTable>("Grid")
.Datasource(ds => ds.URL("GetEmployeeData")
.InsertURL("PerformInsert")
.Adaptor(AdaptorType.UrlAdaptor)
)
.AllowPaging()
. . . .
. . . .
)
public ActionResult GetEmployeeData(DataManager dm)
{
IEnumerable data = (from o in new NORTHWNDEntities1().Tables
//Binding selected data instead of all data
select new EmployeeTable
{
EmployeeID = o.EmployeeID,
FirstName = o.FirstName,
LastName = o.LastName,
Title = o.Title
}).OrderBy(o=> o.EmployeeID);
int count = data.AsQueryable().Count();
DataOperations operation = new DataOperations();
//Performing paging operations
data = operation.PerformSkip(data, dm.Skip);
data = operation.PerformTake(data, dm.Take);
return Json(new { result = data, count = count }, JsonRequestBehavior.AllowGet);
}
|