/// <summary> /// KendoGrid constructor - IEnumerable set, will evaluate set AsQueryable() /// </summary> /// <param name="request">KendoGridRequest object</param> /// <param name="list">IEnumerable set representing a page of data</param> public KendoGrid(KendoGridRequest request, IEnumerable <T> list) { var filtering = request.GetFiltering <T>(); var sorting = request.GetSorting(); Data = list.AsQueryable() .Where(filtering) .OrderBy(sorting).ToList(); Total = Data.Count(); Data = Data .Skip(request.Skip) .Take(request.Take); }
/// <summary> /// KendoGrid constructor - IQueryable set /// </summary> /// <param name="request">KendoGridRequest object</param> /// <param name="query">IQueryable object representing unrealized set of data</param> public KendoGrid(KendoGridRequest request, IQueryable <T> query) { // call another method here to get filtering and sorting. var filtering = request.GetFiltering <T>(); var sorting = request.GetSorting(); var tempQuery = query .Where(filtering) .OrderBy(sorting); Total = tempQuery .Count(); Data = tempQuery .Skip(request.Skip) .Take(request.Take); }