BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
<GRID>
@(Html.EJ().Grid<SyncfusionMvcApplication7.Models.C30000Records>("Grid")
.Datasource(ds => ds.URL(@Url.Action("DataSource")).Adaptor(AdaptorType.UrlAdaptor)) //URL Adaptor
.AllowScrolling()
.AllowSorting()
.ScrollSettings(scroll =>
{
scroll.AllowVirtualScrolling().Height(300).
VirtualScrollMode(VirtualScrollMode.Normal);
})
.Columns(col =>
{
col.Field("CustomerID").IsPrimaryKey(true).Add();
col.Field("CompanyName").Add();
col.Field("City").Add();
col.Field("Address").Add();
})
)
<Controller>
public IEnumerable OrderData = new NORTHWNDEntities().C30000Records.ToList();
public ActionResult DataSource(DataManager dm)
{
IEnumerable data = OrderData;
DataOperations operation = new DataOperations();
if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
{
data = operation.PerformSorting(data, dm.Sorted);
}
if (dm.Where != null && dm.Where.Count > 0) //Filtering
{
data = operation.PerformWhereFilter(data, dm.Where, dm.Where[0].Operator);
}
int count = data.AsQueryable().Count();
if (dm.Skip != 0)
{
data = operation.PerformSkip(data, dm.Skip);
}
if (dm.Take != 0)
{
data = operation.PerformTake(data, dm.Take);
}
return Json(new { result = data, count = count },JsonRequestBehavior.AllowGet);
}
|