-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[docs] Add Rendering section #267
[docs] Add Rendering section #267
Conversation
1a46904
to
37a0ff6
Compare
docs/src/pages/components/data-grid/rendering/ColumnVirtualizationGrid.tsx
Outdated
Show resolved
Hide resolved
docs/src/pages/components/data-grid/rendering/ColumnVirtualizationGrid.tsx
Outdated
Show resolved
Hide resolved
docs/src/pages/components/data-grid/rendering/ColumnVirtualizationGrid.tsx
Outdated
Show resolved
Hide resolved
5f28daa
to
b5ce5c2
Compare
Co-authored-by: Matt <github@nospam.33m.co>
a34476d
to
e4bc305
Compare
e4bc305
to
ddc5d54
Compare
export function AutoSizerWrapper(props: any) { | ||
return <AutoSizer {...props}>{(size: any) => props.children(size)}</AutoSizer>; | ||
} | ||
export const AutoSizerWrapper = AutoSizer; |
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.
Avoid the creation of one component. It should be slightly faster.
export const Cell: React.FC<GridCellProps> = React.memo( | ||
({ | ||
value, | ||
field, | ||
width, | ||
children, | ||
showRightBorder, | ||
export const Cell: React.FC<GridCellProps> = React.memo((props) => { |
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.
coding style convention
!width ? null : <Cell key="empty-col-left" width={width} />, | ||
!width ? null : <Cell width={width} />, |
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 impact of a key
is limited to the component that renders the element. So no impact here.
columns: Columns; | ||
domIndex: number; | ||
extendRowFullWidth: boolean; | ||
firstColIdx: number; | ||
lastColIdx: number; | ||
hasScroll: { y: boolean; x: boolean }; | ||
scrollSize: number; | ||
columns: Columns; | ||
lastColIdx: number; | ||
row: RowModel; | ||
showCellRightBorder: boolean; | ||
extendRowFullWidth: boolean; | ||
rowIndex: number; | ||
domIndex: number; | ||
scrollSize: number; | ||
showCellRightBorder: boolean; |
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.
sort asc
color: theme.palette.text.primary, | ||
...theme.typography.body2, |
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.
move as much CSS as possible to the root.
backgroundColor: fade( | ||
theme.palette.background.default, | ||
theme.palette.action.disabledOpacity, | ||
), |
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.
Add missing color indicator that there is an overlay blocking the interaction on the cells.
<RightEmptyCell key="right-empty" width={renderCtx.rightEmptyWidth} /> | ||
<RightEmptyCell width={renderCtx.rightEmptyWidth} /> |
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.
key
has no impact, the position of the children is known by React, it never changes.
const componentParams: ComponentParams = React.useMemo( | ||
const componentProps: ComponentProps = React.useMemo( |
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.
These used to be render functions, but are components now, hence params
-> props
to avoid confusion.
@@ -8,7 +8,6 @@ export const NUMERIC_COL_DEF: ColTypeDef = { | |||
type: 'number', | |||
align: 'right', | |||
headerAlign: 'right', | |||
width: 80, |
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.
We document 100px as the default, probably also simpler for developers to do the math when they see that they need to add or remove space.
export const stringNumberComparer: ComparatorFn = (v1: CellValue, v2: CellValue) => { | ||
const nillResult = nillComparer(v1, v2); | ||
if (nillResult != null) { | ||
if (nillResult !== null) { | ||
return nillResult; | ||
} |
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 method seems to be relatively slow when sorting 100,000 rows in memory. I'm not sure we have any great alternatives.
94224b9
to
f7bee21
Compare
f7bee21
to
af79aaf
Compare
{ field: 'id', hide: true }, | ||
{ | ||
field: 'date', | ||
width: 500, |
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.
you can add a column type here to render the date formatted
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.
Great idea
How do we access the ant-design grid? |
Scroll at the bottom of the page or on the overview page click on the "100% customizable" link. |
Handle https://deploy-preview-267--material-ui-x.netlify.app/components/data-grid/rendering/