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

[DataGridPro] Allow to group rows based on column value #3277

Merged
merged 51 commits into from
Jan 18, 2022

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Nov 24, 2021

Closes #212

Docs preview

Feature summary

  • Use props.experimentalFeatures.groupingColumns: true to unlock the feature

  • Use props.groupingColumnsModel / props.onGroupingColumnsModelChange to control

  • Use props.initialState.groupingColumns.model to init (I did not store the model directly in initialState.groupingColumns because I feel like we will have additional stuff in this sub-state one day)

  • Use the column menu to group / ungroup columns

  • Use props.groupingColumnMode?: 'single' | 'multiple' to create one grouping column with all the grouping criteria or one grouping column per grouping criteria (if you have an idea for a better name to avoid confusion with our xxxMode?: 'client' | 'server'. I don't want a boolean because AG-Grid has a 3rd mode with no grouping col and with a boolean we would be blocked)

  • Use props.groupingColDef.leafField to render a column cell on the leafs of the grouping column

  • Use props.disableGroupingColumns to fully disable the feature

  • Use colDef.canBeGrouped: false to block grouping on some columns

  • Use colDef.keyGetter to transform your cell value (post valueGetter) into a serializable value

Changelog

Extracted pull requests

Release note

  • 🎁 Allow to group rows based on column values

    ⚠️ This feature is temporarily available on the Pro plan until the release of the Premium plan.

    To avoid future regression for users of the Pro plan, the feature needs to be explicitly activated using the rowGrouping experimental feature flag.

    // To fully control
    <DataGridPro
      rowGroupingModel={rowGroupingModel}
      onRowGroupingModel={newModel => setRowGroupingModel(newModel)}
      experimentalFeatures={{ rowGrouping: true }}
    />
    
    // To initialize without controlling
    <DataGridPro
      initialState={{
        rowGrouping: {
          model: rowGroupingModel,
        },
      }}
      experimentalFeatures={{ rowGrouping: true }}
    />

    See the documentation for more details.

@flaviendelangle flaviendelangle self-assigned this Nov 24, 2021
@flaviendelangle flaviendelangle changed the title [DataGridPro] Allow to group rows based on column value [DataGridPro] Allow to group rows based on column value - WIP Nov 24, 2021
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 27, 2021
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 27, 2021
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 29, 2021
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Nov 29, 2021
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 1, 2021
@github-actions
Copy link

github-actions bot commented Dec 1, 2021

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Dec 1, 2021
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 1, 2021
@github-actions
Copy link

github-actions bot commented Dec 1, 2021

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 2, 2021
@github-actions
Copy link

github-actions bot commented Dec 3, 2021

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Dec 3, 2021
@github-actions
Copy link

github-actions bot commented Dec 3, 2021

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@oliviertassinari oliviertassinari added the plan: Pro Impact at least one Pro user label Dec 5, 2021
@mui-bot
Copy link

mui-bot commented Jan 14, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 150.4 322.1 252.5 242.92 64.91
Sort 100k rows ms 297.8 700.7 551.3 537.14 133.637
Select 100k rows ms 188.7 302.6 201.5 221.78 41.82
Deselect 100k rows ms 104.2 206.5 184.7 172.22 37.47

Generated by 🚫 dangerJS against ff53580

Copy link
Member

@joserodolfofreitas joserodolfofreitas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs are looking very solid.
I've noticed just a couple details and I'm suggesting a single column as the first example because:

  1. it's a gentler introduction
  2. It doesnt replace the headerName with "Group" in contrast with the next example that does it. The explanation for this difference comes then right on the next section "Grouping Columns", which feels like a good introduction sequence.

@flaviendelangle flaviendelangle merged commit f581ac1 into mui:master Jan 18, 2022
@flaviendelangle flaviendelangle deleted the row-grouping branch January 18, 2022 12:33
@mbrookes
Copy link
Member

👏 👏 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plan: Premium Impact at least one Premium user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGrid] Implement Row Grouping by Column
7 participants