Open cullen-hutchison-FHR opened 1 month ago
Hey @cullen-hutchison-FHR ... i'll have a look shortly!
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!
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