ProTable的rowSelection下的 onSelectAll 已经不推荐使用,那现在我应该怎么知道 全选的时候checked是True 还是 False #9205
Unanswered
kelisiWu123
asked this question in
Q&A
Replies: 1 comment
-
Hi @kelisiWu123! I'm Dosu and I’m helping the pro-components team. 现在 ProTable 的 rowSelection 下 onSelectAll 已经不推荐使用,推荐用 onChange 来处理全选事件。onChange 会在全选/取消全选时触发,并带有 info 参数,可以判断当前操作类型。 你可以这样判断全选时 checked 是 true 还是 false: rowSelection={{
onChange: (selectedRowKeys, selectedRows, info) => {
if (info.type === 'all' || info.type === 'none') {
// 全选/取消全选
const checked = selectedRowKeys.length === dataSource.length; // dataSource 是你的表格数据
console.log('全选状态:', checked);
}
}
}}
详细可参考 Ant Design Table 的 rowSelection 定义和说明 和 ProTable 的实现。 To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
ProTable的rowSelection下的 onSelectAll 已经不推荐使用,那现在我应该怎么知道全选的时候checked是True 还是 False
Beta Was this translation helpful? Give feedback.
All reactions