You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MAUI/DataGrid/summaries.md
+274Lines changed: 274 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -369,6 +369,98 @@ public class GroupCaptionConverter : IValueConverter
369
369
370
370

371
371
372
+
### Displaying column summary with title
373
+
374
+
SfDataGrid supports displaying both column summaries and title summaries simultaneously. You can show column summary along with title by defining the [DataGridSummaryRow.Title](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridSummaryRow.html#Syncfusion_Maui_DataGrid_DataGridSummaryRow_Title) and DataGridSummaryRow.TitleColumnCount property, along with defining summary columns. Showing column summary along with title can be only supported if [DataGridSummaryRow.ShowSummaryInRow](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridSummaryRow.html#Syncfusion_Maui_DataGrid_DataGridSummaryRow_ShowSummaryInRow) is disabled.
375
+
376
+
In the code snippet below, DataGridSummaryRow.TitleColumnCount is set as 2, and [DataGridSummaryRow.Title](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridSummaryRow.html#Syncfusion_Maui_DataGrid_DataGridSummaryRow_Title) is defined along with summary columns.
GridSummaryRow captionSummaryRow = new GridSummaryRow()
427
+
{
428
+
Title = "{ColumnName} : {Key} - {ProductCount} Items",
429
+
TitleColumnCount = 2,
430
+
SummaryColumns = new ObservableCollection<ISummaryColumn>()
431
+
{
432
+
new GridSummaryColumn()
433
+
{
434
+
Name = "CustomerName",
435
+
MappingName = "CustomerName",
436
+
SummaryType = SummaryType.CountAggregate,
437
+
Format = "{Count}"
438
+
},
439
+
new GridSummaryColumn()
440
+
{
441
+
Name = "ProductCount",
442
+
MappingName = "ProductName",
443
+
SummaryType = SummaryType.CountAggregate,
444
+
Format = "{Count}"
445
+
}
446
+
}
447
+
};
448
+
449
+
dataGrid.CaptionSummaryRow = captionSummaryRow;
450
+
451
+
{% endhighlight %}
452
+
{% endtabs %}
453
+
454
+
The following screenshot illustrates displaying summary columns with title at same time for `CaptionSummaryRow`.
455
+
456
+

457
+
458
+
### Limitations
459
+
460
+
The following are the limitations of displaying column summary along with title at same time for DataGridSummaryRow:
461
+
462
+
* If FrozenColumnCount is defined as less than DataGridSummaryRow.TitleColumnCount, the title summary will span the range of FrozenColumnCount, since the spanned range and frozen range cannot vary.
463
+
372
464
## Group summary
373
465
374
466
`Group summary` values are calculated based on the records within each group. The summary information will be displayed at the bottom of each group. You can view the group summary row by expanding the corresponding group header. The data grid allows for the addition of any number of group summary rows.
@@ -662,6 +754,84 @@ public class GroupSummaryConverter : IValueConverter
662
754
663
755

664
756
757
+
### Displaying column summary with title
758
+
759
+
SfDataGrid supports displaying both column summaries and title summaries simultaneously. You can show column summary along with title by defining the [DataGridSummaryRow.Title](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridSummaryRow.html#Syncfusion_Maui_DataGrid_DataGridSummaryRow_Title) and DataGridSummaryRow.TitleColumnCount property, along with defining summary columns. Showing column summary along with title can be only supported if [DataGridSummaryRow.ShowSummaryInRow](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridSummaryRow.html#Syncfusion_Maui_DataGrid_DataGridSummaryRow_ShowSummaryInRow) is disabled.
760
+
761
+
In the code snippet below, DataGridSummaryRow.TitleColumnCount is set as 2, and [DataGridSummaryRow.Title](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridSummaryRow.html#Syncfusion_Maui_DataGrid_DataGridSummaryRow_Title) is defined along with summary columns.
GridSummaryRow groupSummaryRow = new GridSummaryRow()
806
+
{
807
+
Title = "Total Price: {PriceAmount} for {ProductCount} Products",
808
+
TitleColumnCount = 2,
809
+
SummaryColumns = new ObservableCollection<ISummaryColumn>()
810
+
{
811
+
new GridSummaryColumn()
812
+
{
813
+
Name = "CustomerName",
814
+
MappingName = "CustomerName",
815
+
SummaryType = SummaryType.CountAggregate,
816
+
Format = "{Count}"
817
+
}
818
+
}
819
+
};
820
+
821
+
dataGrid.GroupSummaryRows.Add(groupSummaryRow);
822
+
823
+
{% endhighlight %}
824
+
{% endtabs %}
825
+
826
+
The following screenshot illustrates displaying summary columns with title at same time for `GroupSummaryRows`.
827
+
828
+

829
+
830
+
### Limitations
831
+
832
+
The following are the limitations of displaying column summary along with title at same time for DataGridSummaryRow:
833
+
834
+
* If FrozenColumnCount is defined as less than DataGridSummaryRow.TitleColumnCount, the title summary will span the range of FrozenColumnCount, since the spanned range and frozen range cannot vary.
665
835
666
836
## Table summaries
667
837
@@ -1112,6 +1282,110 @@ public class TableSummaryConverter : IValueConverter
1112
1282
1113
1283
N> The `DataTemplateSelector` can also be directly assigned to the `SfDataGrid.TableSummaryTemplate`. When using data template selector, performance issues occur as the conversion template views take time within the framework.
1114
1284
1285
+
### Displaying column summary with title
1286
+
1287
+
SfDataGrid supports displaying both column summaries and title summaries simultaneously. You can show column summary along with title by defining the [DataGridTableSummaryRow.Title](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridSummaryRow.html#Syncfusion_Maui_DataGrid_DataGridSummaryRow_Title) and DataGridTableSummaryRow.TitleColumnCount property, along with defining summary columns. Showing column summary along with title can be only supported if [DataGridTableSummaryRow.ShowSummaryInRow](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridSummaryRow.html#Syncfusion_Maui_DataGrid_DataGridSummaryRow_ShowSummaryInRow) is disabled.
1288
+
1289
+
In the code snippet below, DataGridTableSummaryRow.TitleColumnCount is set as 2, and [DataGridTableSummaryRow.Title](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridSummaryRow.html#Syncfusion_Maui_DataGrid_DataGridSummaryRow_Title) is defined along with summary columns.
GridTableSummaryRow topSummaryRow = new GridTableSummaryRow()
1337
+
{
1338
+
ShowSummaryInRow = false,
1339
+
Position = TableSummaryRowPosition.Top,
1340
+
Title = "Total Price : {PriceAmount} for {ProductCount} products",
1341
+
TitleColumnCount = 2,
1342
+
SummaryColumns = new ObservableCollection<ISummaryColumn>()
1343
+
{
1344
+
new GridSummaryColumn()
1345
+
{
1346
+
Name = "CustomerName",
1347
+
MappingName = "CustomerName",
1348
+
SummaryType = SummaryType.CountAggregate,
1349
+
Format = "{Count:d}"
1350
+
}
1351
+
}
1352
+
};
1353
+
1354
+
dataGrid.TableSummaryRows.Add(topSummaryRow);
1355
+
1356
+
GridTableSummaryRow bottomSummaryRow = new GridTableSummaryRow()
1357
+
{
1358
+
ShowSummaryInRow = false,
1359
+
Position = TableSummaryRowPosition.Bottom,
1360
+
Title = "Total Price : {PriceAmount} for {ProductCount} products",
1361
+
TitleColumnCount = 2,
1362
+
SummaryColumns = new ObservableCollection<ISummaryColumn>()
1363
+
{
1364
+
new GridSummaryColumn()
1365
+
{
1366
+
Name = "CustomerName",
1367
+
MappingName = "CustomerName",
1368
+
SummaryType = SummaryType.CountAggregate,
1369
+
Format = "{Count:d}"
1370
+
}
1371
+
}
1372
+
};
1373
+
1374
+
dataGrid.TableSummaryRows.Add(bottomSummaryRow);
1375
+
1376
+
{% endhighlight %}
1377
+
{% endtabs %}
1378
+
1379
+
The following screenshot illustrates displaying summary columns with title at same time for `TableSummaryRows`.
1380
+
1381
+

1382
+
1383
+
### Limitations
1384
+
1385
+
The following are the limitations of displaying column summary along with title at same time for DataGridTableSummaryRow:
1386
+
1387
+
* If FrozenColumnCount is defined as less than DataGridTableSummaryRow.TitleColumnCount, the title summary will span the range of FrozenColumnCount, since the spanned range and frozen range cannot vary.
1388
+
1115
1389
## Formatting summary
1116
1390
1117
1391
In the following sections, the formatting is explained using the `TableSummary`.
0 commit comments