-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[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
Conversation
These are the results for the performance tests:
|
190b0d4
to
6eb433c
Compare
6eb433c
to
c0aca18
Compare
packages/grid/x-data-grid-pro/src/hooks/features/detailPanel/gridDetailPanelSelector.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-data-grid-pro/src/hooks/features/detailPanel/useGridDetailPanel.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-data-grid-pro/src/hooks/features/detailPanel/useGridDetailPanelCache.ts
Show resolved
Hide resolved
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following example demonstrantes this option in action. | |
The following example demonstrates this option in action: |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content looks great!
is this available in the latest version on npm? |
Not yet no, it will be available on today's / tomorrow's release |
Thanks for the prompt reply ! This feature is super useful ! thanks a lot |
Preview: https://deploy-preview-5163--material-ui-x.netlify.app/x/react-data-grid/master-detail/#infer-height-from-the-content
Closes #4091