Skip to content

Commit

Permalink
[PR feedback] Document recommendation for disabling row height switch…
Browse files Browse the repository at this point in the history
…er when using `rowHeights`

@see #5411
  • Loading branch information
cee-chen committed Nov 24, 2021
1 parent fc9f65c commit 4250a73
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src-docs/src/views/datagrid/datagrid_height_options_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ const rowHeightsFullSnippet = `const rowHeightsOptions = useMemo(
inMemory={{ level: 'sorting' }}
sorting={{ columns: sortingColumns, onSort }}
rowHeightsOptions={rowHeightsOptions}
toolbarVisibility={{
showDisplaySelelector: { allowRowHeight: false },
}}
pagination={{
...pagination,
pageSizeOptions: [50, 250, 1000],
Expand Down Expand Up @@ -243,6 +246,18 @@ export const DataGridRowHeightOptionsExample = {
<EuiCodeBlock language="javascript" paddingSize="s" isCopyable>
{rowHeightsSnippet}
</EuiCodeBlock>
<EuiCallOut
color="warning"
title="Disable the row height toolbar control"
>
When using <EuiCode>rowHeights</EuiCode> overrides, we recommend
setting{' '}
<EuiCode>
toolbarVisibility.showDisplaySelector.allowRowHeight
</EuiCode>{' '}
to <EuiCode>false</EuiCode>, as users will otherwise be confused
when switching row heights does not affect specific overriden rows.
</EuiCallOut>
</Fragment>
),
components: { DataGridRowHeightOptions },
Expand Down
3 changes: 3 additions & 0 deletions src-docs/src/views/datagrid/row_height_fixed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ export default () => {
inMemory={{ level: 'sorting' }}
sorting={{ columns: sortingColumns, onSort }}
rowHeightsOptions={rowHeightsOptions}
toolbarVisibility={{
showDisplaySelector: { allowRowHeight: false },
}}
virtualizationOptions={{
// rough average of the cell heights in the example
// accurately setting this smooths out the scrolling experience
Expand Down
3 changes: 3 additions & 0 deletions src/components/datagrid/data_grid_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,9 @@ export interface EuiDataGridRowHeightsOptions {
defaultHeight?: EuiDataGridRowHeightOption;
/**
* Defines the height for a specific row. It can be line count or just height.
*
* When using row height overrides, we strongly setting the `showDisplaySelector: allowRowHeight`
* toolbar control to `false` in #EuiDataGridToolBarVisibilityOptions
*/
rowHeights?: Record<number, EuiDataGridRowHeightOption>;
/**
Expand Down

0 comments on commit 4250a73

Please sign in to comment.