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

[DataGridPremium] Fix excel export causing column with wrong width #13191

Merged
merged 7 commits into from
May 27, 2024

Conversation

romgrk
Copy link
Contributor

@romgrk romgrk commented May 20, 2024

Closes #12641

Before: https://codesandbox.io/p/sandbox/silly-pare-vfzsdq (this fails in CSB, not sure if excel export is testable there?)
After:

@romgrk romgrk added component: data grid This is the name of the generic UI component, not the React module! feature: Export labels May 20, 2024
@mui-bot
Copy link

mui-bot commented May 20, 2024

Deploy preview: https://deploy-preview-13191--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 600cbdc

createValueOptionsSheetIfNeeded(valueOptionsData, valueOptionsSheetName, workbook);

rowIds.forEach((id) => {
const serializedRow = serializeRow(id, columns, api, valueOptionsData, options);
const serializedRow = serializeRow(id, columns, apiRef, valueOptionsData, options);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Confirm if this can also mutate the colspan info.

@@ -85,7 +85,7 @@ const createScrollCache = (
});
type ScrollCache = ReturnType<typeof createScrollCache>;

const isJSDOM = typeof window !== 'undefined' ? /jsdom/.test(window.navigator.userAgent) : false;
const isJSDOM = typeof navigator !== 'undefined' ? /jsdom/.test(navigator.userAgent) : false;
Copy link
Member

@cherniavskii cherniavskii May 22, 2024

Choose a reason for hiding this comment

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

This change caused the tests in JSDOM to fail.
Turns out navigator.userAgent !== window.navigator.userAgent:

https://github.com/mui/material-ui/blob/c409a0c021df73ba85b6147cdaa1736ade61fd74/packages/test-utils/src/createDOM.js#L57-L58

I'll submit a PR to the core repo to fix this inconsistency.

What was the reason for this change anyway? We should revert it for now

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was failing in devmode inside an excel export worker, something being undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not inside a worker but I have no idea why this happens in devmode. I've wrapped in a try.

Screenshot from 2024-05-22 17-09-32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Export
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Export to Excel causes rows to be misaligned from their headers (with checkboxes present)
4 participants