mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.03k stars 1.24k forks source link

[data grid] Improve support of long cells content #7323

Open oliviertassinari opened 1 year ago

oliviertassinari commented 1 year ago

Summary 💡

This issue is a continuation of #1040. We might have an opportunity to improve the UX for end-users when using a table. This surfaced with @prakhargupta1 when using a Toolpad app https://github.com/mui/mui-toolpad/issues/1484.

Facts:

  1. When the content of the cell overflow, end-users only have one option: resize the column width to see the content.
  2. Column resizing is a Pro feature, so not available for community users https://mui.com/x/react-data-grid/column-dimensions/#resizing.
  3. Developers can use getRowHeight auto: https://mui.com/x/react-data-grid/row-height/#dynamic-row-height to wrap a row.

Problems

  1. Cell expander. For some use cases, it's better to have a single line per row to quickly scan the data. So getRowHeight auto isn't an option. Resizing the columns is painful so isn't an option either. A cell expander would improve the UX but the problem is that it's not easy to pull off. e.g. https://github.com/mui/mui-x/issues/1040#issuecomment-780484281:

    Screenshot 2022-12-25 at 13 23 24
  2. Wrapping configuration per column. A hybrid cell wrapping tradeoff is possible for some use cases: keep a single line for more of the cells but wrap a few. This requires setting getRowHeight auto and forcing some of the cells to overflow on a single line. The problem is that it's not easy to pull off:

Screenshot 2022-12-25 at 13 28 05

Some like Elastic UI go as far as allowing end-users to configure it, not just developers:

Screenshot 2022-12-25 at 13 27 28

Options

For pain 1. we could either:

For pain 2. we could either:

Examples 🌈

Screenshot 2022-12-25 at 13 25 42 Screenshot 2022-12-25 at 13 26 32 Screenshot 2022-12-25 at 13 28 05 Screenshot 2022-12-25 at 14 00 19

Motivation 🔦

Improve the browsing experience

cherniavskii commented 1 year ago

Related issue: https://github.com/mui/mui-x/issues/2851

oliviertassinari commented 1 year ago

Once we solve this, we might want to revert #7682.

cherniavskii commented 1 year ago

@gerdadesign Can you look into this one?