syncfusion / flutter-widgets

Syncfusion Flutter widgets libraries include high quality UI widgets and file-format packages to help you create rich, high-quality applications for iOS, Android, and web from a single code base.
1.44k stars 672 forks source link

Unable to view summary text in SFDataGrid #1852

Open jainharsh21 opened 1 week ago

jainharsh21 commented 1 week ago

Bug description

I have been trying to view the summary for the revenue column but it is just showing an empty container, have been stuck on this for quite some time, please help.

Steps to reproduce

Copy paste the code given, you will be able to reproduce

Code sample

Code sample ```dart return SfDataGrid( allowSorting: true, columnWidthMode: ColumnWidthMode.auto, gridLinesVisibility: GridLinesVisibility.both, headerGridLinesVisibility: GridLinesVisibility.both, source: ProductDataSource(productSummary), tableSummaryRows: [ GridTableSummaryRow( showSummaryInRow: true, title: 'Total Revenue: {Sum}', columns: [ const GridSummaryColumn( name: 'Sum', columnName: 'revenue', summaryType: GridSummaryType.sum), ], position: GridTableSummaryRowPosition.bottom) ], columns: [ GridColumn( columnName: 'product', label: const Center( child: Text('Produce', style: AppTheme.fontStyleDefault), ), ), GridColumn( columnName: 'quantity', label: const Center( child: Text('Quantity', style: AppTheme.fontStyleDefault)), ), GridColumn( columnName: 'revenue', label: const Center( child: Text( 'Revenue', style: AppTheme.fontStyleDefault, ), ), ), ], ); ```

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

WhatsApp Image 2024-05-08 at 23 09 50

Stack Traces

Stack Traces ```dart [Add the Stack Traces here] ```

On which target platforms have you observed this bug?

iOS

Flutter Doctor output

Doctor output ```console [Add your output here] ```
jainharsh21 commented 1 week ago

WhatsApp Image 2024-05-08 at 23 09 50

For some reason the image isn't visible in the previous comment

abineshPalanisamy commented 1 week ago

Hi jainharsh,

Based on the provided details, the SfDataGrid doesn't automatically display summary values. To display the summary value, you need to override the buildTableSummaryCellWidget method in the DataGridSource class. The calculated summary value is passed as a parameter to the DataGridSource.buildTableSummaryCellWidget method. Therefore, you need to return the required widget with the summary value. We have attached a sample and provided a UG link for your reference. Please consult the following sample and link for more information. If you have any further concerns, please feel free to reach out.

Regards, Abinesh P