当前位置:网站首页>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;
边栏推荐
- Tar source code analysis 9
- C # symmetric encryption (AES encryption) ciphertext results generated each time, different ideas, code sharing
- ORICO ORICO outdoor power experience, lightweight and portable, the most convenient office charging station
- Manually page the list (parameter list, current page, page size)
- Learn about the Internet of things protocol WiFi ZigBee Bluetooth, etc. --- WiFi and WiFi protocols start from WiFi. What do we need to know about WiFi protocol itself?
- Cervical vertebra, beriberi
- GoogleChromePortable 谷歌chrome浏览器便携版官网下载方式
- Tar source code analysis Part 3
- MySQL 45 learning notes (XI) how to index string fields
- 【问题记录】03 连接MySQL数据库提示:1040 Too many connections
猜你喜欢

SQL injection SQL lab 11~22
![[backpack DP] backpack problem](/img/7e/1ead6fd0ab61806ce971e1612b4ed6.jpg)
[backpack DP] backpack problem

云原生——上云必读之SSH篇(常用于远程登录云服务器)

2022 where to find enterprise e-mail and which is the security of enterprise e-mail system?

Mysql 45讲学习笔记(七)行锁

【GF(q)+LDPC】基于二值图GF(q)域的规则LDPC编译码设计与matlab仿真

centos8安装mysql.7 无法开机启动

Tree DP

Matlab remainder

leetcode825. 适龄的朋友
随机推荐
Arcpy 利用updatelayer函数改变图层的符号系统
[backpack DP] backpack problem
What is a spotlight effect?
ABCD four sequential execution methods, extended application
C # symmetric encryption (AES encryption) ciphertext results generated each time, different ideas, code sharing
内卷怎么破?
Redis interview question set
C realize Snake games
2022 Xinjiang's latest eight members (Safety Officer) simulated examination questions and answers
tars源码分析之5
MySQL 45 lecture learning notes (12) MySQL will "shake" for a while
雲原生——上雲必讀之SSH篇(常用於遠程登錄雲服務器)
C réaliser des jeux de serpents gourmands
Code rant: from hard coding to configurable, rule engine, low code DSL complexity clock
What is Gibson's law?
Tar source code analysis 6
uniapp 自定義環境變量
what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!
Tar source code analysis 8
C實現貪吃蛇小遊戲