-
-
Notifications
You must be signed in to change notification settings - Fork 447
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
Update MRT_FilterTextField.tsx #1260
base: v2
Are you sure you want to change the base?
Update MRT_FilterTextField.tsx #1260
Conversation
empty string as a number
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
if we convert to string to valueAsNumber then column.setfiltervalue is not taking direct 0 value
This pull request includes a small but important change to the
|
@@ -179,7 +179,7 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({ | |||
textFieldProps.type === 'date' | |||
? event.target.valueAsDate | |||
: textFieldProps.type === 'number' | |||
? event.target.valueAsNumber | |||
? isNaN(event.target.valueAsNumber) ? undefined : event.target.value |
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.
shouldn't this still return event.target.valueAsNumber when valid instead of just value
?
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.
The columnFilters are not functioning as expected when the value is a numeric 0,
while they work correctly when the value is the text '0'.
please check the CSB and Video
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.
I am working in ERP application user will check > 0 , >=0, <0,<=0.
Zero is not working when number input it is working as text input.
I want to work with number input.
please check Once
https://github.com/user-attachments/assets/2c26f71d-1b8c-48e1-b0d5-6bc13749c9e6
empty string as a number,
type = "number"
muiFilterTextFieldProps: ({ column }) => {
return {
type: column?.columnDef?.meta?.type, // number
}
Warning: Received NaN for the
value
attribute. If this is expected, cast the value to a string.when manualfilter is true
Plese check the codesandbox