Skip to content

[DataGridPremium] Refine cell selection and speed up clipboard copy - #23473

Merged
michelengelen merged 8 commits into
mui:masterfrom
michelengelen:fix/datagrid/23388-follow-up
Sep 2, 2026
Merged

michelengelen merged 8 commits into
mui:masterfrom
michelengelen:fix/datagrid/23388-follow-up

Conversation

@michelengelen

Copy link
Copy Markdown
Member

Follow-up to #23415. Addresses the review comments in this review.

  • Ctrl+A no longer selects cells of the row reordering column.
  • Ctrl+A no longer selects skeleton rows from lazy loading or aggregation footer rows.
  • selectCellRange now uses the same column filter as Ctrl+A. Ranges from Shift+click, drag, or the API skip the checkbox, detail panel, reorder, and actions columns.
  • The clipboard copy path is faster. The row filter uses a direct model lookup instead of an array scan. The guard exits early instead of building the full cell array. The output string joins once instead of per row.

Note: selectCellRange is a public API method. Ranges that span utility columns now produce a model without those cells.

Benchmark (median from 2 separate runs) with 50,000 rows and 200,000 selected cells (Ctrl+A, then copy):

Select All Copy (old) Copy (new) Speedup copy
3.7ms 4382.5 ms 408.0 ms 10.7×

Both copy paths produce identical output.

Signed-off-by: michel <jsnerdic@gmail.com>
Signed-off-by: michel <jsnerdic@gmail.com>
Signed-off-by: michel <jsnerdic@gmail.com>
…elected cells

Signed-off-by: michel <jsnerdic@gmail.com>
@michelengelen michelengelen self-assigned this Sep 1, 2026
@michelengelen michelengelen added scope: data grid Changes related to the data grid. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. feature: Cell Selection Related to the cell selection feature labels Sep 1, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-23473--material-ui-x.netlify.app/
QR code for https://deploy-preview-23473--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 🔺+1.34KB(+0.18%) 🔺+474B(+0.22%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-scheduler 0B(0.00%) 0B(0.00%)
@mui/x-scheduler-premium 0B(0.00%) 0B(0.00%)
@mui/x-chat 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@MBilalShafi MBilalShafi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All three points from my review on #23415 are addressed, plus the selectCellRange note and the footer judgement call — and each one comes with a test. Thanks for the quick follow-up 💙

Here's the verified fix before/after:

Steps: 1. Click cell (0, currencyPair) → 2. Press Ctrl+A → 3. Press Ctrl+C, watch the status box.

row 0 fields in the model first copied line Ctrl+C (sandbox, dev build) Ctrl+C (prod test build, 3 runs)
after (this PR) id, currencyPair, price1M "0\tPAIR0\t0" ~635 ms 84–92 ms
before (master) __reorder__, id, currencyPair, price1M "\t0\tPAIR0\t0" (leading tab) ~4.4 s 3.36–3.53 s

At 20k rows it's ~460–550 ms → ~37 ms. Both sides produce byte-identical output on this path (50k: 1,116,668 chars, 50,000 lines) — so on my machine the copy speedup is even bigger than the 10.7× in the description 👍

Added a couple minor comments. Apart from them, it LGTM.

@michelengelen
michelengelen enabled auto-merge (squash) September 2, 2026 12:38
@michelengelen
michelengelen merged commit 80ee1d8 into mui:master Sep 2, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: Cell Selection Related to the cell selection feature scope: data grid Changes related to the data grid. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants