Skip to content

[DataGridPro] Add option to infer detail panel height from content #5163

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

Merged
merged 10 commits into from
Jun 29, 2022

Conversation

m4theushw
Copy link
Member

@m4theushw m4theushw commented Jun 9, 2022

@m4theushw m4theushw added component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request plan: Pro Impact at least one Pro user labels Jun 9, 2022
@mui-bot
Copy link

mui-bot commented Jun 9, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 247.6 576.8 348.5 393.86 135.384
Sort 100k rows ms 468.9 1,109.4 685.8 803.34 221.259
Select 100k rows ms 194 216.3 199.7 201.6 7.778
Deselect 100k rows ms 142.6 277.1 186.4 197.54 46.419

Generated by 🚫 dangerJS against cba0141

@m4theushw m4theushw force-pushed the detail-panel-height-auto branch from 190b0d4 to 6eb433c Compare June 9, 2022 19:53

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
@m4theushw m4theushw force-pushed the detail-panel-height-auto branch from 6eb433c to c0aca18 Compare June 9, 2022 20:13

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
The grid assumes the value of 500px by default however this can be configured by passing a function to the `getDetailPanelHeight` prop that returns the required height.
Both props are called with a [`GridRowParams`](/x/api/data-grid/grid-row-params/) object, allowing you to return a different value for each row.
By default, the detail panel height is 500px.
However, this can be customized by passing a function to the `getDetailPanelHeight` prop.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
However, this can be customized by passing a function to the `getDetailPanelHeight` prop.
You can customize it by passing a function to the `getDetailPanelHeight` prop.

Both props are called with a [`GridRowParams`](/x/api/data-grid/grid-row-params/) object, allowing you to return a different value for each row.
By default, the detail panel height is 500px.
However, this can be customized by passing a function to the `getDetailPanelHeight` prop.
This function must return a number or the `"auto"` string.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This function must return a number or the `"auto"` string.
This function must return either a number or the `"auto"` string.

By default, the detail panel height is 500px.
However, this can be customized by passing a function to the `getDetailPanelHeight` prop.
This function must return a number or the `"auto"` string.
Returning a number means that the panel will use as height exactly the value provided.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Returning a number means that the panel will use as height exactly the value provided.
If it returns a number, then the panel will use that value (in pixels) for the height.

However, this can be customized by passing a function to the `getDetailPanelHeight` prop.
This function must return a number or the `"auto"` string.
Returning a number means that the panel will use as height exactly the value provided.
With `"auto"`, the height is [derived](#infer-height-from-the-content) from the content.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
With `"auto"`, the height is [derived](#infer-height-from-the-content) from the content.
If it returns `"auto"`, then the height will be [derived](#infer-height-from-the-content) from the content.

```

:::info
Both props are called with a [`GridRowParams`](/x/api/data-grid/grid-row-params/) object, allowing you to return a different value for each row.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Both props are called with a [`GridRowParams`](/x/api/data-grid/grid-row-params/) object, allowing you to return a different value for each row.
Both props are called with a [`GridRowParams`](/x/api/data-grid/grid-row-params/) object, which lets you return a different value for each row.

:::info
Both props are called with a [`GridRowParams`](/x/api/data-grid/grid-row-params/) object, allowing you to return a different value for each row.
:::

To expand a row, click on the `+` icon or press <kbd class="key">Space</kbd> inside the detail toggle column.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
To expand a row, click on the `+` icon or press <kbd class="key">Space</kbd> inside the detail toggle column.
To expand a row, click on the **+** icon or press <kbd class="key">Space</kbd> inside the detail toggle column.

<DataGridPro getDetailPanelHeight={() => 'auto'} />
```

The following example demonstrantes this option in action.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The following example demonstrantes this option in action.
The following example demonstrates this option in action:

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 10, 2022
@github-actions
Copy link

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

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
…ail-panel-height-auto
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 14, 2022

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Copy link
Contributor

@mapache-salvaje mapache-salvaje left a comment

Choose a reason for hiding this comment

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

Content looks great!

@m4theushw m4theushw merged commit 464913d into mui:master Jun 29, 2022
@m4theushw m4theushw deleted the detail-panel-height-auto branch June 29, 2022 14:36
@alextaymx
Copy link

is this available in the latest version on npm?

@flaviendelangle
Copy link
Member

Not yet no, it will be available on today's / tomorrow's release

@alextaymx
Copy link

Thanks for the prompt reply ! This feature is super useful ! thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request plan: Pro Impact at least one Pro user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data-grid] Master detail/panel - Height based on the content
7 participants