diff --git a/.changeset/fast-hounds-guess.md b/.changeset/fast-hounds-guess.md new file mode 100644 index 000000000000..f548f66278d2 --- /dev/null +++ b/.changeset/fast-hounds-guess.md @@ -0,0 +1,9 @@ +--- +"@refinedev/mui": patch +--- + +fix(use-data-grid): incompatible types when using data-grid-pro + +useDataGrid overide DataGridPropsType onFilterModelChange. + +[Fixes #5997](https://github.com/refinedev/refine/issues/5997) diff --git a/documentation/docs/ui-integrations/material-ui/hooks/use-data-grid/index.md b/documentation/docs/ui-integrations/material-ui/hooks/use-data-grid/index.md index 8209096cf6d7..89293ba625f7 100644 --- a/documentation/docs/ui-integrations/material-ui/hooks/use-data-grid/index.md +++ b/documentation/docs/ui-integrations/material-ui/hooks/use-data-grid/index.md @@ -786,8 +786,8 @@ When the user filters a column, this function is called with the new filter mode {...dataGridProps} columns={columns} autoHeight - onFilterModelChange={(model, details) => { - dataGridProps.onFilterModelChange(model, details); + onFilterModelChange={(model) => { + dataGridProps.onFilterModelChange(model); // do something else }} /> diff --git a/packages/mui/src/hooks/useDataGrid/index.ts b/packages/mui/src/hooks/useDataGrid/index.ts index a6c0f561cc06..730b509ec2fe 100644 --- a/packages/mui/src/hooks/useDataGrid/index.ts +++ b/packages/mui/src/hooks/useDataGrid/index.ts @@ -33,9 +33,13 @@ import { transformSortModelToCrudSorting, } from "@definitions"; +type DataGridPropsOverride = Omit & { + onFilterModelChange: (model: GridFilterModel) => void; +}; + type DataGridPropsType = Required< Pick< - DataGridProps, + DataGridPropsOverride, | "rows" | "loading" | "rowCount"