Skip to content
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

[data grid] Row doesn't have a right border #7956

Closed
2 tasks done
Mistes974 opened this issue Feb 16, 2023 · 3 comments · Fixed by #8091
Closed
2 tasks done

[data grid] Row doesn't have a right border #7956

Mistes974 opened this issue Feb 16, 2023 · 3 comments · Fixed by #8091
Assignees
Labels
component: data grid This is the name of the generic UI component, not the React module!

Comments

@Mistes974
Copy link

Mistes974 commented Feb 16, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example:
https://stackblitz.com/edit/react-pxmuva?file=demo.js

image

Current behavior 😯

As you can see on the example, it's impossible to have a border right on column even if there is no horizontal scroll

Expected behavior 🤔

The customization of the row should allow to have borders

Context 🔦

No response

Your environment 🌎

No response

Order ID 💳 (optional)

No response

@Mistes974 Mistes974 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 16, 2023
@zannager zannager added the component: data grid This is the name of the generic UI component, not the React module! label Feb 16, 2023
@m4theushw
Copy link
Member

You can't use the traditional border property because it increases the size of the row. At the same time, the container where the row lives in has overflow: hidden, so if the children increases the size it will be hidden. Instead, you can try adding a shadow with box-shadow: inset 0px 0px 0px 3px <color>;

@m4theushw m4theushw removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 16, 2023
@Mistes974
Copy link
Author

I tried to use the "box-shadow" property as a substitute for the "border" property, but got the same result... what I'm trying to replicate is this kind of UI :
image

@m4theushw
Copy link
Member

If you can use autoHeight here's an example: https://stackblitz.com/edit/react-pxmuva-jq7ilp?file=demo.js

I noticed that, when the scrollbar is present, there's a bug that makes the row to extend beyond the visible part, making the right border invisible. This can be solved with:

diff --git a/packages/grid/x-data-grid/src/hooks/features/virtualization/useGridVirtualScroller.tsx b/packages/grid/x-data-grid/src/hooks/features/virtualization/useGridVirtualScroller.tsx
index 9d2592fd3..322679a90 100644
--- a/packages/grid/x-data-grid/src/hooks/features/virtualization/useGridVirtualScroller.tsx
+++ b/packages/grid/x-data-grid/src/hooks/features/virtualization/useGridVirtualScroller.tsx
@@ -249,7 +249,7 @@ export const useGridVirtualScroller = (props: UseGridVirtualScrollerProps) => {
 
   const handleResize = React.useCallback<GridEventListener<'debouncedResize'>>((params) => {
     setContainerDimensions({
-      width: params.width,
+      width: rootRef.current?.clientWidth || params.width,
       height: params.height,
     });
   }, []);

When we set setContainerDimensions inside the effect, we use rootRef.current!.clientWidth, which already discounts the scrollbar size (if visible). However, in handleResize we use params.width that ignores the scrollbar size.

@m4theushw m4theushw self-assigned this Mar 21, 2023
@michelengelen michelengelen changed the title [datagrid] Row doesn't have a right border [data grid] Row doesn't have a right border Mar 6, 2024
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!
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants