|
public ActionResult UrlDataSource(DataManager dm)
{
IEnumerable Data = new NorthwindDataContext().OrdersViews.ToList();
DataResult result = new DataResult();
Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations();
List<string> aggregateFields = new List<string>();
if (dm.Search != null)
Data = operation.PerformSearching(Data, dm.Search);
if (dm.Where != null)
Data = operation.PerformWhereFilter(Data, dm.Where, dm.Where[0].Condition); //perform filtering
if (dm.Aggregates != null)
{
for (var i = 0; i < dm.Aggregates.Count; i++)
aggregateFields.Add(dm.Aggregates[i].Field);
result.aggregate = operation.PerformSelect(Data, aggregateFields);
} //perform aggregation.
result.count = Data.AsQueryable().Count();
if (dm.Skip != null && dm.Skip != 0)//skiped while rendering checkbox
Data = operation.PerformSkip(Data, dm.Skip);
if (dm.Take != null && dm.Take != 0)//skiped while rendering checkbox
Data = operation.PerformTake(Data, dm.Take);
result.result = Data;//passed the whole dataSource directly for checkbox rendering
return Json(result, JsonRequestBehavior.AllowGet);
}
|
Hi Richard,
We have checked your code example and we are able to reproduce the reported issue. Since you are performing server side filtering operation after the aggregation. So while handling aggregation before filtering it will retrieve the result based on all data. To avoid the issue we suggest you to handling aggregation based on filtered record instead of whole data (set the aggregation code after performing filtering).Please refer the code example
public ActionResult UrlDataSource(DataManager dm){IEnumerable Data = new NorthwindDataContext().OrdersViews.ToList();DataResult result = new DataResult();Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations();List<string> aggregateFields = new List<string>();if (dm.Search != null)Data = operation.PerformSearching(Data, dm.Search);if (dm.Where != null)Data = operation.PerformWhereFilter(Data, dm.Where, dm.Where[0].Condition); //perform filteringif (dm.Aggregates != null){for (var i = 0; i < dm.Aggregates.Count; i++)aggregateFields.Add(dm.Aggregates[i].Field);result.aggregate = operation.PerformSelect(Data, aggregateFields);} //perform aggregation.result.count = Data.AsQueryable().Count();if (dm.Skip != null && dm.Skip != 0)//skiped while rendering checkboxData = operation.PerformSkip(Data, dm.Skip);if (dm.Take != null && dm.Take != 0)//skiped while rendering checkboxData = operation.PerformTake(Data, dm.Take);result.result = Data;//passed the whole dataSource directly for checkbox renderingreturn Json(result, JsonRequestBehavior.AllowGet);}
Refer the online sample link
Please let us know if you need further assistance.
Regards,Manisankar Durai.