Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Table Columns can't have dynamic filters #37962

Closed
balboFK opened this issue Oct 11, 2022 · 1 comment
Closed

Table Columns can't have dynamic filters #37962

balboFK opened this issue Oct 11, 2022 · 1 comment

Comments

@balboFK
Copy link

balboFK commented Oct 11, 2022

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Just open the sandbox

What is expected?

I expect a way to be possible to set the filters of the column header, based on the value of that column on the dataSource dynamically. Lets say we have the following dataSource that comes from a server after a request:

const dataSource = [
   {
       id: 1,
       name: 'Erick'
   },
   {
       id: 2,
       name: 'Edward'
   },
   {
       id: 3,
       name: 'Elder'
   }
]

const columns = [
   {
       dataSource: 'id',
       title: 'ID'
   },
   {
       dataSource: 'name',
       title: 'Name',
      filters: []
}]

/* 
    
Filters should be an array with the values of the column in the dataSource, like bellow
     
const filters = [
   {
       text: 'Erick',
       value: 'Erick'
   },
 {
       text: 'Edward',
       value: 'Edward'
   },
 {
       text: 'Elder',
       value: 'Elder'
   }]
*/

What is actually happening?

You can only set the values of the "filters" previously because you need to pass the value of the filters to the "columns" of the table.

Environment Info
antd 4.23.5
React 18
System Windows 10
Browser Brave

I spent a lot of my time trying to figure out a way to do this in a good method but I could'nt figure out anything to do this behaviour.

@github-actions
Copy link
Contributor

@ant-design ant-design locked and limited conversation to collaborators Oct 12, 2022
@afc163 afc163 converted this issue into discussion #37963 Oct 12, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant