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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data grid] Multiple lines/children in renderCell doesn't work #2859

Closed
venik2007 opened this issue Oct 13, 2021 · 4 comments 路 Fixed by #3446
Closed

[data grid] Multiple lines/children in renderCell doesn't work #2859

venik2007 opened this issue Oct 13, 2021 · 4 comments 路 Fixed by #3446
Labels
bug 馃悰 Something doesn't work component: data grid This is the name of the generic UI component, not the React module!

Comments

@venik2007
Copy link

venik2007 commented Oct 13, 2021

Current behavior 馃槸

Multiple lines/children in cell doesn't work for v5 (example of solution on stackoverflow works fine for v4, but not for v5);

Expected behavior 馃

Multiple lines/children in cell works well

Steps to reproduce 馃暪

Steps:

  1. Open codesandbox example and see result
  2. Devtools disabling lineHeight solve this issue, but I can't find any workarounds to do it through the code (probably it assigned/calculated by scripts, mui devs knows better)

image
image

Context 馃敠

This issue blocks me. I need to render array of elements in a cell (with my own component with scroller); example of structure:

type Metrics = {
  key: string; 
  value: number;
};

type ServerResponse = {
  // some fields from response
  metrics: Metrics[];
}

And I need to show that metrics array for each entity (row) in a single cell

Your environment 馃寧

`npx @mui/envinfo`
  Browsers: Chrome

image

Order ID 馃挸 (optional)

No response

@venik2007 venik2007 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 13, 2021
@DanailH
Copy link
Member

DanailH commented Oct 14, 2021

Hi, @venik2007 thanks for raising this. It seems to be a duplicate of #417 and/or #438

You can also check here https://mui.com/components/data-grid/columns/#render-cell for a different approach.

@DanailH DanailH added duplicate This issue or pull request already exists and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 14, 2021
@venik2007
Copy link
Author

Hi @DanailH, i'm afraid, this is not duplication, because of:

  1. This is not [DataGrid] Dynamic row height聽#417 because i don't need dynamic height, fixed height is fine for me
  2. This is not [DataGrid] Variable row height聽#438 because i can configure row height through DataGrid rowHeight prop, and it will change to different height (see screenshot with height 100)
    image

And i'm already provide a workaround hot to solve that (see screenshot with disabled lineHeight)
image

The problem is that i can't override that value even locally to fix it for my project

@venik2007
Copy link
Author

venik2007 commented Oct 14, 2021

I found workaround which works for me!
https://codesandbox.io/s/polished-moon-cwv7d?file=/src/Demo.tsx
Wrapping renderCell with <div style={{ lineHeight: "normal" }}> (i don't know why i didn't try it earlier)

image

@DanailH
Copy link
Member

DanailH commented Dec 9, 2021

Ok, this must-have slipped through the notifications. I see what the pain is now, thanks for explaining. The problem is how we center the text.

@DanailH DanailH added bug 馃悰 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! and removed duplicate This issue or pull request already exists labels Dec 9, 2021
@oliviertassinari oliviertassinari changed the title [DataGrid] Multiple lines/children in renderCell doesn't work for MUI5 [DataGrid] Multiple lines/children in renderCell doesn't work Feb 11, 2024
@oliviertassinari oliviertassinari changed the title [DataGrid] Multiple lines/children in renderCell doesn't work [data grid] Multiple lines/children in renderCell doesn't work Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 馃悰 Something doesn't work component: data grid This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants