当前位置:网站首页>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;
边栏推荐
- 《国民经济行业分类GB/T 4754—2017》官网下载地址
- 期末周,我裂开
- tars源码分析之1
- Dimension and format of data
- How to help others effectively
- Mysql 45讲学习笔记(十三)表数据删掉一半,表文件大小不变
- Appium foundation - appium installation (II)
- 由于dms升级为了新版,我之前的sql在老版本的dms中,这种情况下,如何找回我之前的sql呢?
- 24 magicaccessorimpl can access the debugging of all methods
- 1、 Relevant theories and tools of network security penetration testing
猜你喜欢
Arcpy 利用updatelayer函数改变图层的符号系统
what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!
Tree DP
SQL join, left join, right join usage
Matlab remainder
Overview of convolutional neural network structure optimization
《ClickHouse原理解析与应用实践》读书笔记(4)
MySQL installation and configuration
SQL injection SQL lab 11~22
P26-P34 third_ template
随机推荐
期末周,我裂开
Shopping malls, storerooms, flat display, user-defined maps can also be played like this!
Wechat applet scroll view component scrollable view area
Tree DP
Mysql 45讲学习笔记(十三)表数据删掉一半,表文件大小不变
Internet of things protocol ZigBee ZigBee module uses the concept of protocol stack
Redis面试题集
Bicolor case
tcp socket 的 recv 如何接收指定长度消息?
InputStream/OutputStream(文件的输入输出)
Tar source code analysis Part 10
regular expression
Background and current situation of domestic CDN acceleration
ABCD four sequential execution methods, extended application
thread priority
Appium基础 — APPium安装(二)
Mysql 45讲学习笔记(十)force index
Cloud native - SSH article that must be read on the cloud (commonly used for remote login to ECS)
What is Gibson's law?
MySQL 45 lecture learning notes (XIV) count (*)