mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.15k stars 1.3k forks source link

api.setColumnWidth doesn't take effect unless I manually drag / resize the column #15018

Closed httpete closed 2 days ago

httpete commented 2 days ago

Steps to reproduce

I am trying to call setColumnWidth on a keydown event. If I navigate to the header cell, and then call api.setColumnWidth(field, 100); it won't apply. If I manually tweak ever so slightly the drag border, and then issue the call , it works great. It should work whether or not I dragged. I am searching through the code, there is some logic bound up in https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/hooks/features/columnResize/useGridColumnResize.tsx#L297

I am trying to synthetically call the same events to simulate, but it wont work.

Current behavior

No response

Expected behavior

No response

Context

No response

Your environment

npx @mui/envinfo ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```

Search keywords: resize setColumnWidth Order ID: 79357

httpete commented 2 days ago

I think I figured this out. It is because the resizer removes the flex property.

github-actions[bot] commented 2 days ago

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

[!NOTE] @httpete How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.