Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
143046 | Mar 1,2019 04:30 PM UTC | Mar 16,2019 11:58 AM UTC | Xamarin.Forms | 6 |
![]() |
Tags: SfDataGrid |
public class CustomAggregate : ISummaryAggregate
{
public CustomAggregate()
{
}
public double DynmaicValue { get; set; }
public Action<System.Collections.IEnumerable, string, PropertyInfo> CalculateAggregateFunc()
{
return (items, property, pd) =>
{
var enumerableItems = items as IEnumerable<DynamicModel>;
var collection = new ObservableCollection<double>();
foreach (var item in enumerableItems)
{
var dict = item.Values.Where(x => x.Key == "OrderID");
foreach (var value in dict)
{
collection.Add(double.Parse(value.Value.ToString()));
}
}
if (pd.Name == "DynmaicValue")
{
this.DynmaicValue = collection.Sum();
}
};
}
}
//Adding Table summary to the row.
GridTableSummaryRow summaryRow = new GridTableSummaryRow();
summaryRow.Title = "Toal : {TableSummary}";
summaryRow.Position = Position.Top;
summaryRow.ShowSummaryInRow = true;
summaryRow.SummaryColumns.Add(new GridSummaryColumn
{
Name = "TableSummary",
CustomAggregate = new CustomAggregate(),
MappingName = "OrderID",
Format = "{DynmaicValue}",
SummaryType = Syncfusion.Data.SummaryType.Custom
});
grid.TableSummaryRows.Add(summaryRow); |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.