-
-
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
[DataGrid] Remove GridCell
borderBottom
when last row
#3519
[DataGrid] Remove GridCell
borderBottom
when last row
#3519
Conversation
It reminds me of this attempt that I did in #271 at the problem but on which I failed by lack of time. IMHO the right solution is trickier. I see a couple of KO cases in the live preview. |
for (let i = 0; i < renderedRows.length; i += 1) { | ||
const { id, model } = renderedRows[i]; | ||
|
||
const isLastRow = i === renderedRows.length - 1; |
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 will be true
when on the last row of the current render context, which is different from the index relative to all visible rows. Is this what you want? The index
prop gives the "real" index.
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.
Hmm, the index
might also work. The thing is that I need to know if there are fewer rows than the height of the viewport so I can add the border to the last 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.
I think what you need to do is something that's already being done for the columns. Instead of columnsMeta.totalWidth
, use currentPage.rows.length * rowHeight
. To get the height you can try using apiRef.current.getRootDimensions
.
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.
But the current way also works. I don't need to calculate the height, I can know if there is space just by checking the indexes.
Yes, I saw the |
packages/grid/_modules_/grid/hooks/features/virtualization/useGridVirtualScroller.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/hooks/features/virtualization/useGridVirtualScroller.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/containers/GridRootStyles.ts
Outdated
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
These are the results for the performance tests:
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
packages/grid/_modules_/grid/hooks/features/virtualization/useGridVirtualScroller.tsx
Outdated
Show resolved
Hide resolved
👋 The migration PR has been merged. Please follow these steps to make sure that the contents are all updated. (Sorry for the inconvenience)
If you are struggle with the steps above, feel free to tag @siriwatknp |
packages/grid/_modules_/grid/hooks/features/virtualization/useGridVirtualScroller.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/containers/GridRootStyles.ts
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/containers/GridRootStyles.ts
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/virtualization/GridVirtualScrollerContent.tsx
Outdated
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
…remove-last-cell-border-bottom
...ages/grid/x-data-grid/src/internals/components/virtualization/GridVirtualScrollerContent.tsx
Outdated
Show resolved
Hide resolved
packages/grid/x-data-grid/src/internals/components/containers/GridRootStyles.ts
Outdated
Show resolved
Hide resolved
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.
Good job!
Fixes #2315
I've done a potential fix for the issue. The drawback is that now that you have fewer rows than what the grid can load (a black space is visible) and you have a footer enabled then the footer also has a
borderTop
. I think this is how it should have been from the beginning but still, it is technically a breaking change so we need to review it before proceeding.You can check what the change is here: ...
https://deploy-preview-3519--material-ui-x.netlify.app/components/data-grid/