当前位置:网站首页>Cochez une colonne d'affichage dans une colonne de tableau connue
Cochez une colonne d'affichage dans une colonne de tableau connue
2022-07-04 06:41:00 【L'immortel de l'amour de la technologie】
import React, {
useEffect, useState} from 'react';
import {
Table,Checkbox,} from 'antd'
const columns = [
{
title: 'ID',
dataIndex: 'user_id',
key: 'user_id',
width: 100,
},
{
title: 'Un surnom.',
dataIndex: 'nickname',
key: 'nickname',
width: 150,
},
{
title: 'Numéro de téléphone portable',
dataIndex: 'phone',
key: 'phone',
width: 150,
},
{
title: 'Solde',
dataIndex: 'balance',
key: 'balance',
width: 150,
},
{
title: 'Frais de service de la plateforme',
dataIndex: 'service_charge',
key: 'service_charge',
width: 150,
},
{
title: 'Sexe',
dataIndex: 'sex',
key: 'sex',
width: 150,
},
{
title: 'Jours de connexion consécutifs',
dataIndex: 'login_day',
key: 'login_day',
width: 200,
},
{
title: 'Nombre maximum de jours consécutifs de connexion',
dataIndex: 'login_bigday',
key: 'login_bigday',
width: 200,
},
{
title: 'Heure de connexion',
dataIndex: 'login_time',
key: 'login_time',
width: 200,
},
{
title: 'Temps d'ajout',
dataIndex: 'join_time',
key: 'join_time',
width: 200,
},
{
title: 'Statut',
dataIndex: 'status',
key: 'status',
width: 150,
},
]
//Descendez.
const plainOptions = [
{
label: 'ID', value:'user_id' },
{
label: 'Un surnom.', value: 'nickname'},
{
label: 'Numéro de téléphone portable', value:'phone' },
{
label: 'Solde', value: 'balance'},
{
label: 'Frais de service de la plateforme', value:'service_charge'},
{
label: 'Sexe', value: 'sex' },
{
label: 'Jours de connexion consécutifs', value:'login_day' },
{
label: ' Nombre maximal de jours consécutifs de débarquement ', value: 'login_bigday'},
{
label: 'Heure de connexion', value:'login_time' },
{
label: 'Temps d'ajout', value: 'join_time'},
{
label: 'Statut', value:'status'},
];
const TableTreeChange = () => {
//Prenez levalue Configuré pour répondre à la mise à jour de l'interface
const [selectColum,setSelectColum]=useState(columns)
// Original par défaut sélectionné valueValeur
const [checkedList, setCheckedList] = useState(['user_id']);
// Mettez les sélections multiples que vous avez cochées dans un tableau
const onChange = (list) => {
setCheckedList(list)
};
useEffect(() => {
console.log(checkedList,66666666666666666)
//Utilisation de la doublefor Boucle à sélectionner value Et dans les colonnes du tableau keyLes valeurs sont liées
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]);
}
}
}
// La section suivante du Code est destinée à ajouter une colonne d'action fixe au tableau , Si vous n'avez pas besoin d'ignorer
newList.push({
title: 'Fonctionnement',
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;
边栏推荐
- MySQL 45 learning notes (XI) how to index string fields
- Realize IIC data / instruction interaction with micro batg135
- Average two numbers
- [backpack DP] backpack problem
- Software keywords and process information intercepted by Golden Shield video player
- Distributed cap theory
- ABCD four sequential execution methods, extended application
- Selection (023) - what are the three stages of event propagation?
- [March 3, 2019] MAC starts redis
- Is the insurance annuity product worth buying? Is there a hole?
猜你喜欢

R统计绘图-随机森林分类分析及物种丰度差异检验组合图

2022 Xinjiang's latest eight members (Safety Officer) simulated examination questions and answers

期末周,我裂开
![[number theory] fast power (Euler power)](/img/1e/5d032c8f2e43f553b4543d28ea2a2d.jpg)
[number theory] fast power (Euler power)

SQL injection SQL lab 11~22

17-18. Dependency scope and life cycle plug-ins

ORICO ORICO outdoor power experience, lightweight and portable, the most convenient office charging station
![[problem record] 03 connect to MySQL database prompt: 1040 too many connections](/img/bb/4d8d202cf5c6e556bc860a734e5934.png)
[problem record] 03 connect to MySQL database prompt: 1040 too many connections

树形dp

The solution of win11 taskbar right click without Task Manager - add win11 taskbar right click function
随机推荐
27-31. Dependency transitivity, principle
2022 Xinjiang's latest eight members (Safety Officer) simulated examination questions and answers
R统计绘图-随机森林分类分析及物种丰度差异检验组合图
2022 where to find enterprise e-mail and which is the security of enterprise e-mail system?
P26-P34 third_ template
What is the sheji principle?
Learning multi-level structural information for small organ segmentation
云原生——上云必读之SSH篇(常用于远程登录云服务器)
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?
Uniapp custom environment variables
The solution of win11 taskbar right click without Task Manager - add win11 taskbar right click function
金盾视频播放器拦截的软件关键词和进程信息
MySQL 45 learning notes (XI) how to index string fields
Distributed cap theory
C # symmetric encryption (AES encryption) ciphertext results generated each time, different ideas, code sharing
【问题记录】03 连接MySQL数据库提示:1040 Too many connections
Tar source code analysis 4
Tar source code analysis 8
抽奖系统测试报告
Tar source code analysis Part 7