Description
Tasks
Render something using ag-grid functionality
Handle percent case
We cannot resolve fieldObject without params.data as several databases can be mixed in the columns and percents can be mixed with usual numbers, currencies etc.
Handle number with unit case
Upgrade ag-grid to 31.3.2, to use the newest API
Switch to the new API, fix TS, etc
Allow selecting aggregation type
Render aggregation type in the cell
Add selector
Persist value to the view
Rely on the value, calculating colDefs
Fix the styling issues
Make it sticky
Render the "Total" label
Handle optimization somehow. The problem is collapsed items are eliminated from the tree, so grand totals cannot be calculated properly for the deeper levels until all the branches are expanded.
Calculate which level has columns to aggregate, and then discard applying optimization for these levels?
Hide under the flag
Problem with Tree View mode
When using Tree Data, columns defined with an aggregation function will always perform aggregations on the group nodes. This means any supplied group data will be ignored in favour of the aggregated values. However if there are no child nodes to aggregate, the provided value in the row data will be displayed.
Handled with some hacks, and it could be broken somewhere
It took 5 minutes to find the case when it's broken
Decision: calculate aggregations only for the leaf level columns
Unlock Totals for count field
In the first iteration, we basically did what Airtable/Notion did.
But we will cut the corners, and add aggregations only for the numeric fields
It's simple, cells in the last row are empty by default. On hover can see a hint that aggregation is available.
If the aggregation is already chosen, we see the aggregation type and the value, by clicking on the cell we can change the aggregation type in the dropdown menu. The value is calculated on the client, maybe I will be able to use ag-grid functionality for it.
Notion aggregation types:
Sum
Average
Median
Min
Max
Range (Max minus Min)
Airtable adds to it:
NOTE: Footer should always be visible
In a scope of the feature, we calculate aggregations for databases selected at the root level (it can be multiple), ignoring the database the items are grouped by.
Refs
Notion
If there is no hierarchy in the table view, an aggregation can be displayed at the last row.
Known issues