Skip to content

Update MRT_FilterTextField.tsx#1260

Merged
KevinVandy merged 3 commits intoKevinVandy:v2from
NarenderDhamarlapally:patch-2
Feb 14, 2025
Merged

Update MRT_FilterTextField.tsx#1260
KevinVandy merged 3 commits intoKevinVandy:v2from
NarenderDhamarlapally:patch-2

Conversation

@NarenderDhamarlapally
Copy link
Copy Markdown

@NarenderDhamarlapally NarenderDhamarlapally commented Oct 7, 2024

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

empty string as a number
@vercel
Copy link
Copy Markdown

vercel bot commented Oct 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
material-react-table ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 8, 2024 5:46am
material-react-table-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 8, 2024 5:46am

if we convert to string to valueAsNumber then 
column.setfiltervalue is not taking direct 0 value
@NarenderDhamarlapally
Copy link
Copy Markdown
Author

This pull request includes a small but important change to the MRT_FilterTextField component in the packages/material-react-table package. The change ensures that the value is properly handled when the input type is number.

? event.target.valueAsDate
: textFieldProps.type === 'number'
? event.target.valueAsNumber
? isNaN(event.target.valueAsNumber) ? undefined : event.target.value
Copy link
Copy Markdown
Owner

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?

Copy link
Copy Markdown
Author

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

Copy link
Copy Markdown
Author

@NarenderDhamarlapally NarenderDhamarlapally Nov 13, 2024

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

@KevinVandy KevinVandy merged commit 1d5a3cc into KevinVandy:v2 Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants