当前位置:网站首页>Check and display one column in the known table column
Check and display one column in the known table column
2022-07-04 06:41:00 【Technology loving immortal】
import React, {
useEffect, useState} from 'react';
import {
Table,Checkbox,} from 'antd'
const columns = [
{
title: 'ID',
dataIndex: 'user_id',
key: 'user_id',
width: 100,
},
{
title: ' nickname ',
dataIndex: 'nickname',
key: 'nickname',
width: 150,
},
{
title: ' cell-phone number ',
dataIndex: 'phone',
key: 'phone',
width: 150,
},
{
title: ' balance ',
dataIndex: 'balance',
key: 'balance',
width: 150,
},
{
title: ' Platform service fee ',
dataIndex: 'service_charge',
key: 'service_charge',
width: 150,
},
{
title: ' Gender ',
dataIndex: 'sex',
key: 'sex',
width: 150,
},
{
title: ' Continuous login days ',
dataIndex: 'login_day',
key: 'login_day',
width: 200,
},
{
title: ' Maximum number of consecutive login days ',
dataIndex: 'login_bigday',
key: 'login_bigday',
width: 200,
},
{
title: ' Landing time ',
dataIndex: 'login_time',
key: 'login_time',
width: 200,
},
{
title: ' Time to join ',
dataIndex: 'join_time',
key: 'join_time',
width: 200,
},
{
title: ' state ',
dataIndex: 'status',
key: 'status',
width: 150,
},
]
// The drop-down
const plainOptions = [
{
label: 'ID', value:'user_id' },
{
label: ' nickname ', value: 'nickname'},
{
label: ' cell-phone number ', value:'phone' },
{
label: ' balance ', value: 'balance'},
{
label: ' Platform service fee ', value:'service_charge'},
{
label: ' Gender ', value: 'sex' },
{
label: ' Continuous login days ', value:'login_day' },
{
label: ' Maximum consecutive login days ', value: 'login_bigday'},
{
label: ' Landing time ', value:'login_time' },
{
label: ' Time to join ', value: 'join_time'},
{
label: ' state ', value:'status'},
];
const TableTreeChange = () => {
// Put the selected value Set it to be responsive to update the interface
const [selectColum,setSelectColum]=useState(columns)
// Originally selected by default value value
const [checkedList, setCheckedList] = useState(['user_id']);
// Put the multiple choices you checked into an array
const onChange = (list) => {
setCheckedList(list)
};
useEffect(() => {
console.log(checkedList,66666666666666666)
// Use double for Cycle the selected value And columns in the table key Values are linked
let newList=[]
for (let i = 0; i < checkedList.length; i++){
for (let j = 0; j < columns.length; j++){
if (checkedList[i] == columns[j].key) {
newList.push(columns[j]);
}
}
}
// The following part of the code is to add a fixed operation column to the table , If you don't need it, you can ignore
newList.push({
title: ' operation ',
key: 'action',
render: (text, record) => (
<span>
<a>edit</a>
</span>
),
width: 100,
fixed: 'right',
})
setSelectColum(newList)
}, [checkedList])
return (
<div>
<Table
columns={
selectColum}
pagination={
false}
/>
<Checkbox.Group options={
plainOptions} value={
checkedList} onChange={
onChange} />
</div>
);
};
export default TableTreeChange;
边栏推荐
- Realize IIC data / instruction interaction with micro batg135
- What is the "relative dilemma" in cognitive fallacy?
- R统计绘图-随机森林分类分析及物种丰度差异检验组合图
- How does the inner roll break?
- what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!
- Mysql 45讲学习笔记(六)全局锁
- Tar source code analysis 4
- 24 magicaccessorimpl can access the debugging of all methods
- Arcpy uses the updatelayer function to change the symbol system of the layer
- Uniapp custom environment variables
猜你喜欢

GoogleChromePortable 谷歌chrome浏览器便携版官网下载方式

Native Cloud - SSH articles must be read on Cloud (used for Remote Login to Cloud Server)

Can the out of sequence message complete TCP three handshakes

树形dp

leetcode 310. Minimum Height Trees

Cervical vertebra, beriberi

Bicolor case

【GF(q)+LDPC】基于二值图GF(q)域的规则LDPC编译码设计与matlab仿真
![[number theory] fast power (Euler power)](/img/1e/5d032c8f2e43f553b4543d28ea2a2d.jpg)
[number theory] fast power (Euler power)

Abap:ooalv realizes the function of adding, deleting, modifying and checking
随机推荐
Matlab remainder
Tar source code analysis 8
Displaying currency in Indian numbering format
Modify TCP timestamp to optimize transmission performance
2022年,或许是未来10年经济最好的一年,2022年你毕业了吗?毕业后是怎么计划的?
selenium IDE插件下载安装使用教程
Tar source code analysis Part 7
Mysql 45讲学习笔记(七)行锁
Analysis of tars source code 1
C实现贪吃蛇小游戏
27-31. Dependency transitivity, principle
Software keywords and process information intercepted by Golden Shield video player
STM32 单片机ADC 电压计算
Cervical vertebra, beriberi
R统计绘图-随机森林分类分析及物种丰度差异检验组合图
ABCD four sequential execution methods, extended application
运算符<< >>傻瓜式测试用例
Abap:ooalv realizes the function of adding, deleting, modifying and checking
Mysql 45讲学习笔记(十一)字符串字段怎么加索引
2022, peut - être la meilleure année économique de la prochaine décennie, avez - vous obtenu votre diplôme en 2022? Comment est - ce prévu après la remise des diplômes?