From 74a1780a91c72ae31aa5a3fac7763d53814d5578 Mon Sep 17 00:00:00 2001 From: NarenderDhamarlapally <121660181+NarenderDhamarlapally@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:54:47 +0530 Subject: [PATCH 1/3] Update MRT_FilterTextField.tsx empty string as a number --- .../src/components/inputs/MRT_FilterTextField.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx b/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx index 61adf3755..353d8f6d2 100644 --- a/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx +++ b/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx @@ -179,7 +179,7 @@ export const MRT_FilterTextField = ({ textFieldProps.type === 'date' ? event.target.valueAsDate : textFieldProps.type === 'number' - ? event.target.valueAsNumber + ? event.target.value === "" ? event.target.value : event.target.valueAsNumber : event.target.value; handleChange(newValue); textFieldProps?.onChange?.(event); From 12d0c3f0f06d6baba63a7cd5f9b97173fa50ff92 Mon Sep 17 00:00:00 2001 From: NarenderDhamarlapally <121660181+NarenderDhamarlapally@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:37:20 +0530 Subject: [PATCH 2/3] Update MRT_FilterTextField.tsx --- .../src/components/inputs/MRT_FilterTextField.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx b/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx index 353d8f6d2..b8270a1ba 100644 --- a/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx +++ b/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx @@ -179,7 +179,7 @@ export const MRT_FilterTextField = ({ textFieldProps.type === 'date' ? event.target.valueAsDate : textFieldProps.type === 'number' - ? event.target.value === "" ? event.target.value : event.target.valueAsNumber + ? isNaN(event.target.valueAsNumber) ? undefined : event.target.valueAsNumber : event.target.value; handleChange(newValue); textFieldProps?.onChange?.(event); From baa2beb1dc8e7880d56413b86ec817423a906339 Mon Sep 17 00:00:00 2001 From: NarenderDhamarlapally <121660181+NarenderDhamarlapally@users.noreply.github.com> Date: Tue, 8 Oct 2024 11:07:08 +0530 Subject: [PATCH 3/3] Update MRT_FilterTextField.tsx if we convert to string to valueAsNumber then column.setfiltervalue is not taking direct 0 value --- .../src/components/inputs/MRT_FilterTextField.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx b/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx index b8270a1ba..380738a19 100644 --- a/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx +++ b/packages/material-react-table/src/components/inputs/MRT_FilterTextField.tsx @@ -179,7 +179,7 @@ export const MRT_FilterTextField = ({ textFieldProps.type === 'date' ? event.target.valueAsDate : textFieldProps.type === 'number' - ? isNaN(event.target.valueAsNumber) ? undefined : event.target.valueAsNumber + ? isNaN(event.target.valueAsNumber) ? undefined : event.target.value : event.target.value; handleChange(newValue); textFieldProps?.onChange?.(event);