-
-
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] Valueparser not called when clearing cell #13628
Comments
You have created a support request under the "Priority Support" terms, which is a paid add-on to MUI X Premium ⏰. Please validate your support key using the link below: https://tools-public.mui.com/prod/pages/jyhs86t?repo=mui-x&issueId=13628 Do not share your support key in this issue! Priority Support is only provided to verified customers. Once you have verified your support key, we will remove the |
Hey @louisaaron ... this should only happen in row edit mode. Here is a diff that gets a potential fix started: diff --git a/packages/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts b/packages/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts
index 33932d806..41c33fceb 100644
--- a/packages/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts
+++ b/packages/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts
@@ -442,7 +442,28 @@ export const useGridRowEditing = (
let newValue = apiRef.current.getCellValue(id, field);
if (fieldToFocus === field && (deleteValue || initialValue)) {
- newValue = deleteValue ? '' : initialValue;
+ if (deleteValue) {
+ const fieldType = apiRef.current.getColumn(field).type;
+ switch (fieldType) {
+ case 'boolean':
+ newValue = false;
+ break;
+ case 'date':
+ case 'dateTime':
+ case 'number':
+ newValue = undefined;
+ break;
+ case 'singleSelect':
+ newValue = null;
+ break;
+ case 'string':
+ default:
+ newValue = '';
+ break;
+ }
+ } else if (initialValue) {
+ newValue = initialValue;
+ }
}
acc[field] = { I'll open this up as a good first issue. 👍🏼 |
assign me |
Hey @kmr-ankitt sry for the late reply. I have been on PTO. |
Hey guys! Any progress here? Thanks |
Nothing yet @louisaaron ... I'll open a PR myself to fix this! |
Awesome thanks so much @michelengelen |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note We value your feedback @louisaaron! How was your experience with our support team? |
Thanks @michelengelen ! |
The problem in depth
Here's the current flow when you edit a selected cell (single click not double click) with a custom cell editor then start typing a value:
What should happen:
Your environment
`npx @mui/envinfo`
Search keywords: valueparser
The text was updated successfully, but these errors were encountered: