Skip to content
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

setColumnFilter(num) is broken when given a numeric value #5949

Open
2 tasks done
sheam opened this issue Mar 7, 2025 · 0 comments
Open
2 tasks done

setColumnFilter(num) is broken when given a numeric value #5949

sheam opened this issue Mar 7, 2025 · 0 comments

Comments

@sheam
Copy link

sheam commented Mar 7, 2025

TanStack Table version

8.21.2

Framework/Library version

React 18.2.0

Describe the bug and the steps to reproduce it

When I set a numeric column filter, it immediately reverts to undefined, but it works if I set it to a string value.

const col = table.getColumn('colour');
const onClick = () => {
   col.setColumnFilter('purple');
};
useEffect(() => {
   console.log(col.getColumnFilter()); // prints undefined, undefined, purple
}, [col]);

But when I use a numeric column filter value it behaves differently.

const col = table.getColumn('colourId');
const onClick = () => {
   col.setColumnFilter(99);
};
useEffect(() => {
   console.log(col.getColumnFilter()); // prints undefined, undefined
}, [col]);

The sandbox shows the issue pretty clearly.

  • Click the "Red colour" filter button and view that the filter works.
  • Click the "Clear filters" button to reset the filters.
  • Click the "Red colourId" filter button and see that it does nothing. Essentially the filter set up in showRedByIdClicked() has not effect...

Let me know if there is more I can do to help.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/sandbox/kzxcl2

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

No, because I do not know how

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
@sheam sheam changed the title setColumnFilter(num) fails to set filter value setColumnFilter(num) is broken when given a numeric value Mar 7, 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

No branches or pull requests

1 participant