mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[data grid] Implement cell selection with range

Open oliviertassinari opened this issue 6 years ago • 14 comments

Turn the 1D selection (rows) into 2D (cells).

Capture d’écran 2021-06-07 à 22 48 25

Benchmark

  • https://glideapps.github.io/glide-data-grid/?path=/story/glide-data-grid-docs--search
  • https://ag-grid.com/javascript-grid-range-selection/
  • https://handsontable.com/docs/8.0.0/demo-selecting-ranges.html
  • https://adazzle.github.io/react-data-grid/docs/examples/cell-range-selection
  • https://www.telerik.com/kendo-react-ui/components/grid/selection/

🔥 Release (Edit: Sep142022)

We expect to release it in Q4 2022. This will be a v6 feature, so if you're okay using alpha and beta packages, you'll probably be able to use it at least a month sooner.

If anyone is willing to help steer the direction of the components, please consider giving us a user interview. We'd love to know more about your use cases, pain points, and expectations for this and other features.

oliviertassinari avatar Aug 22 '20 21:08 oliviertassinari

A couple of thoughts about the implementation of this feature:

  1. Rename useGridSelection -> useGridRowSelection
  2. Keep selectionModel and onSelectionModelChange only for row selection. We could rename them as well
  3. Create the useGridRangeSelection hook with its own state
  4. Add a rangeSelectionModel prop to control the range selection
  5. Clicking a cell firstly focuses it
  6. Clicking and moving the mouse selects other cells (focus remains in the first clicked/outlined)

Note: When I say "focus" I refer to update the focus state.

image

m4theushw avatar Jul 01 '21 21:07 m4theushw

Hello. Any idea on the timeline of the release of this feature?

sergzz12 avatar Feb 06 '22 17:02 sergzz12

I wanna implement a Date Range picker in MUI DataGridPro is there any solution?

sajjadalidev avatar Feb 14 '22 06:02 sajjadalidev

Hello. Would really love to see this feature implemented.

fabioel avatar Mar 29 '22 09:03 fabioel

Some clarifications are needed about this feature request

How are multiple selections made? (any or all of these)

  1. click and drag to select a "block"
  2. ctrl/cmd-click to select individual cells that may not be near each other
  3. click to select, then shift-click to select a block of cells
  4. How to select for keyboard-only users

Editing Cells

I am interested in the ability to edit multiple cells at once. Would this be a separate feature? There is some complexity about this feature:

  1. We may want to limit editing multiple cells to a single column where (we presume) the type of content will be the same.
  2. How do we then limit this if the user needs to also be able to select groups of cell in multiple columns for copy and paste?
  3. The edit will need to take place somewhere. If multiple cells are selected, I think it would be good to have a separate spot, perhaps a small modal, with a field that you would enter the new data. This would solve 2 above because that field would only appear if cells from a single column were selected. Also, that field could have a button with "update {x} cells" to alert the user on what will be updated.

DmitriXBS avatar Mar 29 '22 17:03 DmitriXBS

For the editing it look a lot like https://github.com/mui/mui-x/issues/4262

We have several tightly related subjects around cell selection I think it would be worth cleaning the issues

flaviendelangle avatar Mar 30 '22 07:03 flaviendelangle

Maybe we will also need an onCopy event in case of formatting the copied values

semihucari avatar Jun 02 '22 08:06 semihucari

Is there an update on this? The roadmap for Q3 was never updated.

samborambo305 avatar Aug 21 '22 20:08 samborambo305

Is there any timeline when this will be available? We have a release this year, where it would be awesome to have this feature

fabioel avatar Sep 02 '22 19:09 fabioel

@fabioel, @samborambo305, We expect to release it in Q4. It will be a v6 feature, so if you're okay using alpha and beta packages, you'll probably be able to use it at least a month sooner.

And if anyone is willing to help steer the direction of the components, please consider giving us a user interview. We'd love to know more about your use cases, pain points, and expectations for this and other features.

joserodolfofreitas avatar Sep 14 '22 08:09 joserodolfofreitas

The initial implementation of the cell selection feature is complete. You can visit the pre-release docs and play with it.

We would like the feedback from everyone #6567 on what this feature is lacking for it to be awesome and satisfy most of the use cases. Note that this implementation doesn't contain yet the ability to copy the selected cells to clipboard or edit multiple cells at once. Clipboard support will be added in #199.

m4theushw avatar Nov 02 '22 00:11 m4theushw

Hello, is the cell selection feature available for use in an alpha or a beta build?

Sandrodro avatar Nov 16 '22 13:11 Sandrodro

@Sandrodro it's not available in the alpha version yet, but you can use the pre-release build from the docs by opening any demo in CodeSandbox.

m4theushw avatar Nov 16 '22 13:11 m4theushw

oh ok, and do you have an ETA when the v6.0 version proper will be released?

Sandrodro avatar Nov 16 '22 13:11 Sandrodro