diff --git a/docs/data/migration/migration-data-grid-v6/migration-data-grid-v6.md b/docs/data/migration/migration-data-grid-v6/migration-data-grid-v6.md index 45f326e91160..1ebfbeed7f21 100644 --- a/docs/data/migration/migration-data-grid-v6/migration-data-grid-v6.md +++ b/docs/data/migration/migration-data-grid-v6/migration-data-grid-v6.md @@ -115,18 +115,18 @@ Below are described the steps you need to make to migrate from v6 to v7. - The signature of the function returned by `getApplyFilterFn` has changed for performance reasons: ```diff -const getApplyFilterFn: GetApplyFilterFn = (filterItem) => { - if (!filterItem.value) { - return null; - } - - const filterRegex = new RegExp(escapeRegExp(filterItem.value), 'i'); -- return (cellParams) => { -- const { value } = cellParams; -+ return (value, row, colDef, apiRef) => { - return value != null ? filterRegex.test(String(value)) : false; - }; -} + const getApplyFilterFn: GetApplyFilterFn = (filterItem) => { + if (!filterItem.value) { + return null; + } + + const filterRegex = new RegExp(escapeRegExp(filterItem.value), 'i'); +- return (cellParams) => { +- const { value } = cellParams; ++ return (value, row, colDef, apiRef) => { + return value != null ? filterRegex.test(String(value)) : false; + }; + } ``` - The `getApplyQuickFilterFnV7` in `GridColDef` was renamed to `getApplyQuickFilterFn`. @@ -135,18 +135,18 @@ const getApplyFilterFn: GetApplyFilterFn = (filterItem) => { - The signature of the function returned by `getApplyQuickFilterFn` has changed for performance reasons: ```diff -const getGridStringQuickFilterFn: GetApplyQuickFilterFn = (value) => { - if (!value) { - return null; - } - const filterRegex = new RegExp(escapeRegExp(value), 'i'); -- return (cellParams) => { -- const { formattedValue } = cellParams; -+ return (value, row, column, apiRef) => { -+ let formattedValue = apiRef.current.getRowFormattedValue(row, column); - return formattedValue != null ? filterRegex.test(formattedValue.toString()) : false; - }; -}; + const getGridStringQuickFilterFn: GetApplyQuickFilterFn = (value) => { + if (!value) { + return null; + } + const filterRegex = new RegExp(escapeRegExp(value), 'i'); +- return (cellParams) => { +- const { formattedValue } = cellParams; ++ return (value, row, column, apiRef) => { ++ let formattedValue = apiRef.current.getRowFormattedValue(row, column); + return formattedValue != null ? filterRegex.test(formattedValue.toString()) : false; + }; + }; ```