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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data grid] Is there a way to ignore the actions columns on paste in the data grid? #13449

Open
cullen-hutchison-FHR opened this issue Jun 11, 2024 · 2 comments
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Clipboard Related to clipboard copy or paste functionalities support: commercial Support request from paid users support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@cullen-hutchison-FHR
Copy link

cullen-hutchison-FHR commented Jun 11, 2024

The problem in depth

Hello,

I encountered an issue while copy-pasting full grows in the data grid. One of the columns in our datagrid is an actions column that doesn't carry a value. Copying from this column works as expected, giving a tab-separated list of row values. However, when pasting, the first element from our clipboard gets placed in the actions column, resulting in all columns being off by one.

I have a functional solution using the splitClipboardPastedText prop. I check the length of each row and if it is equal to column definition length - 1, then it "must" be a full row, so I add an empty string to the beginning of the array. Is there another way to go about this or a way to explicitly ignore the actions column on paste?

Recreated our solution on stackblitz

Your environment

`npx @mui/envinfo`
  System:
    OS: Linux 6.5 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
  Binaries:
    Node: 20.14.0 - /usr/local/share/nvm/versions/node/v20.14.0/bin/node
    npm: 10.7.0 - /usr/local/share/nvm/versions/node/v20.14.0/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: Not Found
  npmPackages:
    @emotion/react:  11.11.4 
    @emotion/styled:  11.11.5 
    @mui/base:  5.0.0-beta.40 
    @mui/core-downloads-tracker:  5.15.18 
    @mui/icons-material:  5.15.18 
    @mui/lab:  5.0.0-alpha.170 
    @mui/material:  5.15.18 
    @mui/private-theming:  5.15.14 
    @mui/styled-engine:  5.15.14 
    @mui/system:  5.15.15 
    @mui/types:  7.2.14 
    @mui/utils:  5.15.14 
    @mui/x-data-grid:  7.4.0 
    @mui/x-data-grid-premium:  7.4.0 
    @mui/x-data-grid-pro:  7.4.0 
    @mui/x-date-pickers:  7.4.0 
    @mui/x-date-pickers-pro:  7.4.0 
    @mui/x-license:  7.2.0 
    @types/react:  18.3.2 
    react:  18.2.0 
    react-dom:  18.2.0 
    typescript: ~5.4.5 => 5.4.5 

Search keywords: clipboard actions datagrid copy paste
Order ID: 87778

@cullen-hutchison-FHR cullen-hutchison-FHR added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Jun 11, 2024
@michelengelen michelengelen added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Clipboard Related to clipboard copy or paste functionalities support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/ labels Jun 12, 2024
@michelengelen michelengelen changed the title [question] Is there a way to ignore the actions columns on paste in the data grid? [data grid] Is there a way to ignore the actions columns on paste in the data grid? Jun 12, 2024
@michelengelen
Copy link
Member

Hey @cullen-hutchison-FHR ... i'll have a look shortly!

@michelengelen
Copy link
Member

It looks like we could do better here. I agree. I am just not sure how atm.
I'll add this to the board for the team to have a look!
Thanks for raising this!

@michelengelen michelengelen removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 12, 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! feature: Clipboard Related to clipboard copy or paste functionalities support: commercial Support request from paid users support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
Projects
Status: 🆕 Needs refinement
Development

No branches or pull requests

2 participants