SfDatagrid not showing Summary results in GridTableSummaryRow

Hi,

I have an SfDatagrid in my flutter project and I am stuck debugging a strange issue. I assign columns to my datagrid dynamically everything works smoothly but now while adding Summary row nothing shows. What could be the cause of this? This is how I add my Columns

                columns: _getColumns().map<GridColumn>((String columnName) {
                  return GridColumn(
                    columnName: columnName,
                    label: Container(
                      alignment: Alignment.center,
                      // padding: const EdgeInsets.all(2.0),
                      child: Text(
                        columnName.toUpperCase(),
                        style: const TextStyle(
                            fontSize: 14, fontWeight: FontWeight.bold),
                      ),
                    ),
                  );
                }).toList()


And this is how I add my Summary Row

                tableSummaryRows: [
                  GridTableSummaryRow(
                      showSummaryInRow: false,
                      columns: [
                        const GridSummaryColumn(
                            name: "bonus_sum",
                            columnName: "bonus",
                            summaryType: GridSummaryType.sum)
                      ],
                      position: GridTableSummaryRowPosition.bottom)
                ]


This is the code for my buildTableSummaryCellWidget

  @override
  Widget? buildTableSummaryCellWidget(
      GridTableSummaryRow summaryRow,
      GridSummaryColumn? summaryColumn,
      RowColumnIndex rowColumnIndex,
      String summaryValue) {
    print("buildTableSummaryCellWidget called $summaryValue");
    return Center(
      child: Text(
        summaryValue,
        style: const TextStyle(
          fontSize: 25,
          fontWeight: FontWeight.bold,
        ),
      ),
    );
  }



Please assist me as this is really making the development experience difficult for me. Thanks


Best Regards,

Ammar


1 Reply

AP Abinesh Palanisamy Syncfusion Team July 31, 2024 09:34 AM UTC

Hi Ammar,


Based on the provided details, we conducted a test with a simple sample on our side. We couldn't replicate the issue as you described. We have performed the summary calculations based on column names. Based on the provided images, you are retrieving the column names from the collection, and in Table summaries, you have manually entered the column names. We believe that the mismatch in column names is causing the issue with the summaries. Therefore, we kindly request you to verify and rectify the appropriate column names for accurate summaries.


If you are still encountering the same problem, we kindly request you to modify the attached sample to reproduce the issue and provide additional clear details. This will greatly assist us in investigating the issue further and providing an appropriate solution as quickly as possible.


Regards,

Abinesh P


Attachment: SfDataGrid_5522b399.zip

Loader.
Up arrow icon