ant-design / ant-design/pro-components
👑 [需求] ProTable 控制是否展示全选框列
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
### 🔩 所属模块或组件
ProTable
### 🥰 需求描述
希望添加全选框列是否展示的属性
### ⛰ 功能需求适用场景
默认表单不展示全选框列,当用户点击编辑按钮时展示全选框列
### 🧐 解决方案
是否可以在 rowSelection 中添加 hideSelectAllColumn 属性,通过该属性控制是否展示全选框列
### 🚑 其他信息
目前虽然可以通过 rowSelection 中的 `hideSelectAll` 属性隐藏表头的复选框,并结合 rowSelection 中 `renderCell` 通过以下代码做到隐藏。
```
const [selection, setSelection] = useState(false);
...
renderCell: (r, _, originNode) => {
if (selection) {
return originNode;
}
return null;
}
```
下图是上述方案的效果

Contributor guide
Research direction
Start by inspecting ProTable's rowSelection handling and how its selection column is rendered. Add a rowSelection option that controls whether the selection column appears, preserving the current default behavior, and verify that it can be shown when editing is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100