ant-design / ant-design/pro-components

🧐[问题]ProTable的列设置columnsState属性中,onChange事件返回的数据,因是否已点击了【重置】而不一致,有时候会返回全部列对象,有时候返回已操作列对象而已

Open
#6,606 4 comments 0 reactions 0 assignees View on GitHub
⭕️ bug AI Reply table
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

🧐 问题描述
ProTable组件的列设置属性columnsState,该属性的onChange事件的回调,返回的data,有时候只有当前设置的列对象(图二),有时候返回所有列对象(图一)。总结发现,当点击【重置】之后,再去进行隐藏(或固定列)操作,返回的data只有当前设置的列对象,不是所有的列对象;页面刷新,只要没有点【重置】的时候,返回的都是所有列对象,请问这是bug吗?就不能给一致的吗,这样让我们很难处理

💻 示例代码
columnsState={{
value: columnsStateMap,
onChange: (data) => onChangeColumnsState(data),
}}

🚑 其他信息
图一:
![image](https://user-images.githubusercontent.com/92795771/218690216-ad368c11-9b0f-47c3-b505-e97ca0efe6e1.png)
图二:
![image](https://user-images.githubusercontent.com/92795771/218690238-bf830893-b15b-4046-b6c9-6f7717f546d1.png)

Contributor guide

Open the contributing guide

Research direction

Start at the ProTable columnsState prop and its onChange callback, using the example in the issue to reproduce the behavior. Compare the returned data after refreshing, then after clicking reset and hiding or fixing a column; done means the callback returns a consistent shape in both sequences.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.