-
-
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
[DataGrid] Remove trailing spaces in filter input #5279
Conversation
These are the results for the performance tests:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't be better to trim inside the operator? If filterModel.items.value
contains space it shows no result: https://codesandbox.io/s/controlledfilters-demo-mui-x-forked-84qzhq?file=/demo.tsx
@m4theushw My concern was about how to disable the We can simply pass prop to the Input component, but accessing to the filtering engine seems a bit more complicated |
We can add an argument to diff --git a/packages/grid/x-data-grid/src/colDef/gridStringOperators.ts b/packages/grid/x-data-grid/src/colDef/gridStringOperators.ts
index b6ccd38b5..f97a44e06 100644
--- a/packages/grid/x-data-grid/src/colDef/gridStringOperators.ts
+++ b/packages/grid/x-data-grid/src/colDef/gridStringOperators.ts
@@ -15,7 +15,7 @@ export const getGridStringQuickFilterFn = (value: any) => {
};
};
-export const getGridStringOperators = (): GridFilterOperator<
+export const getGridStringOperators = (disableTrim: boolean = false): GridFilterOperator<
any,
number | string | null,
any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleaner now.
Fix #5275
The dev proposed that when entering
"is ok "
the filter applies with"is ok"
(without the last space)