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.53k stars 1.31k forks source link

Multi Select cell support for Data Grid #11257

Closed martinjlowm closed 11 months ago

martinjlowm commented 11 months ago

Summary 💡

Grids/sheets are usually considered two dimensional, but some types of data may have nested structures. Has any thought gone into supporting multi select in the past?

There are some complexity concerns, namely,

  1. Multi select adds a third (nested) dimension
  2. A third dimension requires its own (de-)serialization step not to interfere with the two dimensions of the grid
  3. Value representation. If the table is exported as comma separated data, the selected options cannot be encoded with comma separation

Examples 🌈

https://github.com/mui/mui-x/assets/110860/0f4c3542-f454-4908-828c-c4636d3b8696

Motivation 🔦

We recently started the migration of our existing tables from a mix of different frameworks to Data Grid. One cell component we felt was missing was a multi select component to select a number of options. I'm no Excel guru, but it seems Excel does offer multi select with comma separation: https://www.ablebits.com/office-addins-blog/create-multi-select-dropdown-excel/

We're happy to contribute the implementation we have so far (the Storybook recording above). It's mostly inspired by the single select cell.

Search keywords: datagrid cell component multi select

michelengelen commented 11 months ago

Hi @martinjlowm ... IMO the solution you have there is looking great. Nice work!

@cherniavskii should we use this as inspiration for a new recipe, or should we provide a built-in solution? (it seems @martinjlowm has a working solution and offered to contribute this, right?)

cherniavskii commented 11 months ago

There's an issue for it already: https://github.com/mui/mui-x/issues/4410 There was also a PR https://github.com/mui/mui-x/pull/8099. Unfortunately, we didn't manage to merge it. Would you like to pick it up?

martinjlowm commented 11 months ago

Interesting! Sure. Strangely enough I didn't find any of those two by searching for just "multi" 😅. I can try to merge what I have against that PR and see where that brings me.

github-actions[bot] commented 11 months ago

The issue has been inactive for 7 days and has been automatically closed. If you think that it has been incorrectly closed, please reopen it and provide missing information (if any) or continue the last discussion.