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

[XGrid] Column resizing broken in StrictMode #177

Closed
Ackermannen opened this issue Aug 16, 2020 · 3 comments · Fixed by #436
Closed

[XGrid] Column resizing broken in StrictMode #177

Ackermannen opened this issue Aug 16, 2020 · 3 comments · Fixed by #436
Assignees
Labels
bug 🐛 Something doesn't work priority: important This change can make a difference

Comments

@Ackermannen
Copy link

I opened up a new react project to test x-grid and it works for the most part, but resizing doesn't seem to work at the moment.

I've set up my project like this:

import React from 'react';

import { XGrid, RowsProp, ColDef, LicenseInfo } from '@material-ui/x-grid';

LicenseInfo.setLicenseKey(test);

const rows: RowsProp = [
  { id: 1, col1: 'Hello', col2: 'World' },
  { id: 2, col1: 'XGrid', col2: 'Awesome' },
  { id: 3, col1: 'Material-UI', col2: 'Amazing' },
];

const columns: ColDef[] = [
  { field: 'id', hide: true},
  { field: 'col1', headerName: 'Column 1', resizable: true },
  { field: 'col2', headerName: 'Column 2', resizable: true },
];

function App() {
  return (
    <div className='App' style={{ height: 400, width: '100%', display: 'flex', flexGrow: 1 }}>
      <XGrid columns={columns} rows={rows} />
    </div>
  );
}

export default App;

The drag button does seem to work but nothing happens. I also get this error inside the console when i try to drag the columns:

index-esm.js:15 Uncaught TypeError: Cannot read property 'field' of undefined
    at fr (index-esm.js:15)
    at index-esm.js:264
    at HTMLDivElement.<anonymous> (index-esm.js:264)
@Ackermannen Ackermannen changed the title Column resizing doesn't seem to work. [XGrid] Column resizing throws type errors Aug 16, 2020
@Ackermannen
Copy link
Author

Issue was due to using StrictMode in project

@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Aug 17, 2020
@oliviertassinari
Copy link
Member

@Ackermannen Thanks for the report. I could put a reproduction on https://codesandbox.io/s/modest-herschel-4vkmo?file=/src/index.js. This is important, I'm reopening.

@oliviertassinari oliviertassinari added component: data grid This is the name of the generic UI component, not the React module! priority: important This change can make a difference labels Aug 17, 2020
@oliviertassinari oliviertassinari changed the title [XGrid] Column resizing throws type errors [DataGrid] Column resizing throws type errors Aug 22, 2020
@oliviertassinari oliviertassinari changed the title [DataGrid] Column resizing throws type errors [DataGrid] Column resizing broken in StrictMode Oct 8, 2020
@oliviertassinari
Copy link
Member

A note, if we were developing the components with StrictMode enabled, we would have avoided this issue. However, I believe that to enable StrictMode on the documentation and the storybook, some other problems will need to be solve first. So, one step at the time.

@oliviertassinari oliviertassinari self-assigned this Oct 9, 2020
@oliviertassinari oliviertassinari changed the title [DataGrid] Column resizing broken in StrictMode [XGrid] Column resizing broken in StrictMode Oct 11, 2020
@oliviertassinari oliviertassinari added components: XGrid and removed component: data grid This is the name of the generic UI component, not the React module! labels Oct 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work priority: important This change can make a difference
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants