maxim-saplin / data_table_2

In-place substitute for Flutter's DataTable and PaginatedDataTable with fixed/sticky header and extra features
https://pub.dev/packages/data_table_2
BSD 3-Clause "New" or "Revised" License
202 stars 135 forks source link

Add support for column aggregates #289

Open JerichoCross opened 1 month ago

JerichoCross commented 1 month ago

If a column is defined as 'numeric', there should also be an option to specify an aggregate (Sum, Median, Mean etc. or leave null for not required). If one of the columns has one of these defined, add an extra row at the bottom with the appropriate aggregates calculated e.g.

DataTable2(
  columns: [
    DataColumn2(
      label: Text("Name"),
    ).
    DataColumn2(
      label: Text("Age"),
      numeric: true,
      aggregate: ColumnAggregate.mean,
    ),
  ],
),

Would produce:

Name Age
John Smith 28
Steve Jones 31
David Cross 22
27
maxim-saplin commented 3 weeks ago

Thanks for the suggestion. No plans to work on that feature.

This can be easily achieved via custom row. DataTable2 is not intended to be a rich control in traditional sense, it is a think widget with little behind the scenes logic.