Skip to content

column.enableGlobalFilter is not considered in the default implemenation of table.getColumnCanGlobalFilter #5138

Closed

Description

@bugii

Describe the bug

When the first value of a column is neither a string nor a number, this column is considered to be not filterable according to the docs.

However, I would have expected that either:

  1. The default implementation of table.getColumnCanGlobalFilter checks whether enableGlobalFilter is manually set to true inside the columnDefs.
  2. The "more specific" property (in that case on the columnDefs) takes precedence over the global table setting.

Your minimal, reproducible example

https://codesandbox.io/s/cocky-shape-3fct22?file=/src/App.js

Steps to reproduce

Type "hello" into the input box.

Expected behavior

Table is filtered correctly.

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

  • OS: MacOS
  • Browser: Chrome

react-table version

8.10.7

TypeScript version

No response

Additional context

No response

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.

Activity

  1. mvarendorff2 commented on Jun 24, 2024

    @mvarendorff2

    I am currently using

        getColumnCanGlobalFilter: (c) =>
          c.columnDef.enableGlobalFilter ??
          Filters.getDefaultOptions!(table).getColumnCanGlobalFilter(c),

    as a workaround. This uses the default implementation as a fallback in case no explicit value is set for enableGlobalFilter.

    Filters is import { Filters } from "@tanstack/react-table";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions