-
-
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] Duplicating columns when grouping. #12223
Comments
Hey @RomanMain and thanks for raising this issue. For a workaround (and maybe for additional filtering if needed) you can use the const filterColumns = ({ columns }: FilterColumnsArgs) => {
return columns.filter((column) => column.type !== 'custom').map((column) => column.field);
};
...
<DataGridPremium
{...data}
apiRef={apiRef}
initialState={initialState}
onRowSelectionModelChange={handleRowSelectionModelChange}
rowSelectionModel={rowSelectionModel}
checkboxSelection
hideFooter
slotProps={{
filterPanel: {
filterFormProps: {
filterColumns,
},
},
}}
/> In this specific case we can just filter by I will still put this on our board to see if the current behavior is intended. |
Thanks for the quick response @michelengelen! This works for the filter list, but how can I remove this in the "Manage columns" panel as well? I can’t see a slotProps similar to this in the documentation. |
No problem ... I did forget to include that. Important The slotProp got changed in v7 TLDR; const getTogglableColumns = (columns: GridColDef[]) => {
return columns.filter((column) => column.type !== 'custom').map((column) => column.field);
};
...
<DataGridPremium
{...data}
apiRef={apiRef}
initialState={initialState}
onRowSelectionModelChange={handleRowSelectionModelChange}
rowSelectionModel={rowSelectionModel}
checkboxSelection
hideFooter
slotProps={{
filterPanel: {
filterFormProps: {
filterColumns,
},
},
columnsManagement: {
getTogglableColumns,
},
}}
/> |
Hey @RomanMain, As @michelengelen mentioned, the Customize the list of columns in panel seems exactly what you are looking for. The demo depicts how to hide the |
The issue has been inactive for 7 days and has been automatically closed. |
The problem in depth
When grouping a specific column, we have automatically generated new columns that are added to the filtering list and the “manage columns” section. Their names are completely duplicated. Is there some option to prevent these duplicate columns from appearing in these lists?
https://stackblitz.com/run?file=Demo.js
Your environment
`npx @mui/envinfo`
Search keywords: grouping, duplicate columns
Order ID: 82865
The text was updated successfully, but these errors were encountered: