当前位置:网站首页>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;
边栏推荐
- Tree DP
- uniapp 自定义环境变量
- 请问旧版的的常用SQL怎么迁移到新版本里来?
- Tar source code analysis 9
- regular expression
- 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 Part 2
- 24 magicaccessorimpl can access the debugging of all methods
- Cervical vertebra, beriberi
- tars源码分析之2
猜你喜欢
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] introduction, function, creation, view, deletion and modification of database view (with exercises)
双色球案例
ORICO ORICO outdoor power experience, lightweight and portable, the most convenient office charging station
MySQL 45 lecture learning notes (VII) line lock
[backpack DP] backpack problem
uniapp 自定義環境變量
The solution of win11 taskbar right click without Task Manager - add win11 taskbar right click function
【网络数据传输】基于FPGA的百兆网/兆网千UDP数据包收发系统开发,PC到FPGA
Tree DP
随机推荐
ABCD four sequential execution methods, extended application
双色球案例
Analysis of tars source code 1
Average two numbers
The width of the picture in rich text used by wechat applet exceeds the problem
Selection (023) - what are the three stages of event propagation?
24 magicaccessorimpl can access the debugging of all methods
uniapp 自定义环境变量
SQL injection SQL lab 11~22
抽奖系统测试报告
C语言中的排序,实现从小到大的数字排序法
P26-P34 third_ template
Common JS tool Libraries
What is the sheji principle?
centos8安装mysql.7 无法开机启动
Common usage of time library
How does the inner roll break?
雲原生——上雲必讀之SSH篇(常用於遠程登錄雲服務器)
2022 is probably the best year for the economy in the next 10 years. Did you graduate in 2022? What is the plan after graduation?
Distributed cap theory