Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added data aggregation #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

WhoCares4400
Copy link

@WhoCares4400 WhoCares4400 commented Jul 4, 2024

Added data aggregation

Added data aggregation - values will be displayed on row group headers, aligned with columns.
User can specify the aggregation function for specific column from predefined functions or provide their own function.

Predefined aggregation methods that can be passed as string to "aggFunc" attribute:

  • "avg" - average of all values in column
  • "sum" - sum of values in column
  • "count" - count of rows
  • "max" - max value from all values in column
  • "min" - min value from all values in column

Example:
https://codepen.io/Jakub-Turczyski/pen/MWdNxwY

New column attributes:

  1. aggFunc - name of aggregation function or custom function provided by the user (REQUIRED)
  2. aggDecimalPlaces - grouping aggregation default decimal places count (default 2)
  3. aggShowTrailingZeros - defines whether the aggregated values should show trailing zeros or not (default false)

New "rowGroup" attributes:

  1. aggPaddingLeft - grouping aggregation left padding value (default '10px')
  2. aggPaddingRight - grouping aggregation right padding value (default '10px')
  3. aggTextAlign - grouping aggregation default text alignment (default 'center')
  4. aggDecimalPlaces - grouping aggregation default decimal places count - can be redefined for each column as well (default 2)
  5. aggShowTrailingZeros - defines whether the aggregated values should show trailing zeros or not - can be redefined for each column as well (default false)

@AllanJard
Copy link
Contributor

Very cool! Thank you for the PR. I'm travelling atm so I can't do a proper review, and I have some ideas that I'd like to use to align this with in DataTables core, so it might not make it in straight away, but I think this will be a great addition - thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants