当前位置:网站首页>antd table+checkbox 默认值显示
antd table+checkbox 默认值显示
2022-07-27 10:22:00 【会跳舞的小猴子】

在antd 官网我使用的是defaultSelectedRowKeys,页面对默认数值进行了反显
但是在我的代码中并不好使
我用了selectedRowKeys
<Table className='table-cy'
rowSelection={
{
type:"checkbox",
selectedRowKeys:arr,
defaultSelectedRowKeys:["1391713813278482433"],
...rowSelection,
}}
columns={
this.state.columnsTable}
dataSource={
userList}
scroll={
{
y: 292}}
rowKey='id'
pagination={
false}
selectedRows={
this.onChangeAll}
/>
const rowSelection = {
onChange: (selectedRowKeys, selectedRows) => {
this.state.selectedUsers = selectedRowKeys
this.state.selectedUserRow = selectedRows
console.log(selectedRowKeys, selectedRows)
this.setState({
arr:selectedRowKeys
})
},
getCheckboxProps: record => ({
defaultChecked: record.selected === 1, // 配置默认勾选的列
}),
};

即可反显
边栏推荐
- Oracle resizing data files
- 【Liunx】安装Redis
- Matlab discrete event system simulation experiment
- 让人深思:句法真的重要吗?邱锡鹏组提出一种基于Aspect的情感分析的强大基线...
- 深度解析:什么是Diffusion Model?
- Samba server
- Local connection to remote server database under Windows platform (I)
- warning package.json: No license field报错
- Camera switching
- 全校软硬件基础设施一站式监控 ,苏州大学以时序数据库替换 PostgreSQL
猜你喜欢

warning: remote HEAD refers to nonexistent ref, unable to checkout报错信息

File upload vulnerability bypass method

让人深思:句法真的重要吗?邱锡鹏组提出一种基于Aspect的情感分析的强大基线...

phpstudy中Apache无法启动

异构计算技术分析

颜值爆表!推荐两款JSON可视化工具,配合Swagger使用真香

已解决SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 2-3: truncated

Customized modification based on jira7.9.2

Tdengine business ecosystem partner recruitment starts
![[shutter] SharedPreferences](/img/e4/e7518126d35c9ed0eeeacabb262cd3.png)
[shutter] SharedPreferences
随机推荐
Edata base, a secondary development project based on spark packaging, is introduced
ASP.NET Core依赖注入之旅:1.理论概念
[brother hero June training] day 24: line segment tree
免费 DIY 之旅问题
OpenAtom OpenHarmony分论坛,今天14:00见!附大事记精彩发布
基于Spark封装的二次开发工程edata-base,介绍
File upload vulnerability related
文档智能多模态预训练模型LayoutLMv3:兼具通用性与优越性
Matlab/simulink sample sharing for solving differential equations
Warning: remote head references to nonexistent ref, unable to checkout error messages
一起学习C语言:结构体(二)
Share machine learning notes (PDF version) + practical projects (dataset + code)
Solved syntaxerror: (Unicode error) 'Unicode scape' codec can't decode bytes in position 2-3: truncated
JSP自定义标签之自定义分页01
Local connection to remote server database under Windows platform (I)
Li Kou brush question 02 (sum of three numbers + sum of maximum subsequence + nearest common ancestor of binary tree)
Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 1)
Gamer questions
深度解析:什么是Diffusion Model?
TDengine 助力西门子轻量级数字化解决方案 SIMICAS 简化数据处理流程