-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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] Hide column icon-separator for column resizable='false' #12017
Comments
Hey @niralivasoya
You can use the Let me know if you need anything else. |
@cherniavskii should we add a recipe for this? |
The issue has been inactive for 7 days and has been automatically closed. |
Hey @niralivasoya ... while writing the recipe I found an easier way to do this: import * as React from 'react';
import { DataGridPro, GridColDef, gridClasses } from '@mui/x-data-grid-pro';
const rows = [
{
id: 1,
username: '@MUI',
age: 20,
},
];
const columns: GridColDef[] = [
{
field: 'id',
},
{
field: 'username',
width: 125,
minWidth: 150,
maxWidth: 200,
resizable: false,
},
{ field: 'age', resizable: false },
];
export default function ColumnHeaderHideSeparator() {
return (
<div style={{ height: 250, width: '100%' }}>
<DataGridPro
columns={columns}
rows={rows}
sx={{
[`& .${gridClasses.columnSeparator}`]: {
[`&:not(.${gridClasses['columnSeparator--resizable']})`]: {
display: 'none',
},
},
}}
/>
</div>
);
} I am still putting this into the recipe section, but wanted to notify you here as well. |
Simplest solution...
|
Steps to reproduce
This is how normally icon separators look like when we set disableColumnResize={false}. That means it allows you to resize the column, and this is how it looks when we hover over the header:
Current behavior
I want to allow the resize column only for the first column and disable the resizable to others. So, it is not allowed to resize other columns except the first one.
I want to hide the iron separator for other columns (where I set resizable to false). Ideally, we don't need an icon separator for those columns.
Expected behavior
How can I only show the icon separator for the resizable columns and hide it for others? How can I set the style? Any suggestions?
Thanks.
Context
This is the demo link:
https://codesandbox.io/p/sandbox/column-resizable-78jz77
Your environment
This is my current environment:
Search keywords: data-grid, column resize, hide icon speerator
The text was updated successfully, but these errors were encountered: