-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] The user should not hide all columns; at least one column should be displayed #13328
Comments
Thanks @vadaviya638 for opening an issue for this problem. I'll add this to the board! |
Hi @michelengelen, thanks for updating this issue. Is there a guide on extending or overriding the behavior of the built-in MUI Columns Menu we can use as a workaround for now? Ideally we could clone the built-in one MUI uses and just add some custom logic. |
Hey @mparsakia import * as React from 'react';
import { DataGrid, GridPanelWrapper, GridSlots } from '@mui/x-data-grid';
import { useDemoData } from '@mui/x-data-grid-generator';
const CustomColumnsPanel: GridSlots['columnsPanel'] = (props) => {
console.log(props);
return <GridPanelWrapper {...props}>COLUMNS MANAGEMENT</GridPanelWrapper>;
};
export default function CustomToolbarGrid() {
const { data } = useDemoData({
dataSet: 'Commodity',
rowLength: 10,
maxColumns: 6,
});
return (
<div style={{ height: 400, width: '100%' }}>
<DataGrid
{...data}
slots={{
columnsPanel: CustomColumnsPanel,
}}
/>
</div>
);
} But this would mean a ton of custom implementation. const apiRef = useGridApiContext(); |
Would be a way to just import (or clone) and modify the existing MUI Columns menu while we wait on a fix? If possible, it shouldn't be too hard to shoe in some checks if trying to hide the last existing column. |
As mentioned in #14395 it would be a good idea to show an overlay like we do for having no rows. |
any updates regarding this issue? |
Is there some docs where we can see how the |
Steps to reproduce
No response
Current behavior
screen-capture.48.webm
screen-capture.49.webm
Expected behavior
at least one column display
Context
No response
Your environment
No response
Search keywords: datagrid
The text was updated successfully, but these errors were encountered: