[Bug] 当时树形结构时且headerType设置为 'checkbox',checked通过function获取的参数中的行数据不正确
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 486
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 16
Description
Version
@visactor/react-vtable": "^1.17.6"
Link to Minimal Reproduction
none
Steps to Reproduce
import { ListTable } from '@visactor/react-vtable';
import React from 'react';
function CheckboxDemo() {
const columns = [
{
field: 'check',
title: '',
width: 60,
headerType: 'checkbox',
cellType: 'checkbox',
headerStyle: {
textAlign: 'center',
},
style: {
textAlign: 'center',
},
disable: (args) => {
const { col, row } = args;
return row !== 0 && row % 2 === 0;
},
checked: (args) => {
const { col, row } = args;
console.log('checked args', args, col, row);
return row % 2 === 0;
},
},
{
field: 'code',
title: '序号',
width: 'auto',
tree: true,
headerStyle: {
textAlign: 'center',
},
},
];
const mockData = [
{
code: '0',
firstName: '129.696',
secondName: '2',
thirdName: '-60.704',
description: '这是很长很长的测试这是很长很长的测试这是很长很长的测试这是很长很长的测试',
date: '2022-01-01',
group: 'girl',
year: '2021',
applicable: '是',
children: [
{
code: '0.1', // 对应原子code
firstName: '125.44',
secondName: '2',
thirdName: '42.56',
description: '这是一段测试',
year: '2016',
applicable: '是',
children: [
{
code: '0.1.1',
firstName: '125.44',
secondName: '2',
thirdName: '42.56',
applicable: '',
year: '2016',
},
{
code: '0.1.2',
firstName: '1375.92',
secondName: '3',
thirdName: '550.2',
year: '2016',
},
],
},
{
code: '0.2', // 对应原子code
firstName: '1375.92',
secondName: '3',
thirdName: '550.2',
applicable: '是',
year: '2016',
date: '2022-01-02',
children: [
{
code: '0.2.1',
firstName: '125.44',
secondName: '2',
thirdName: '42.56',
applicable: '',
year: '2018',
},
{
code: '0.2.2',
firstName: '1375.92',
secondName: '3',
thirdName: '550.2',
applicable: '是',
year: '2018',
},
],
},
],
},
{
code: '1',
firstName: '229.696',
secondName: '20',
thirdName: '90.704',
year: '2018',
applicable: '否',
date: '2022-01-02',
children: [
{
code: '1.1', // 对应原子code
firstName: '225.44',
secondName: '5',
thirdName: '462.56',
applicable: '否',
year: '2016',
},
{
code: '1.2', // 对应原子code
firstName: '375.92',
secondName: '8',
thirdName: '550.2',
applicable: '否',
year: '2016',
},
{
code: '1.3', // 对应原子code
firstName: '425.44',
secondName: '7',
thirdName: '342.56',
applicable: '否',
year: '2018',
},
{
code: '1.4', // 对应原子code
firstName: '175.92',
secondName: '6',
thirdName: '750.2',
applicable: '否',
year: '2018',
},
],
},
{
code: '2',
firstName: '129.696',
secondName: '2',
thirdName: '-60.704',
year: '2023',
applicable: '是',
children: [
{
code: '2.1', // 对应原子code
firstName: '125.44',
secondName: '2',
thirdName: '42.56',
applicable: '否',
children: [
{
code: '2.1.1',
firstName: '125.44',
secondName: '2',
thirdName: '42.56',
applicable: '否',
},
{
code: '2.1.2',
firstName: '1375.92',
secondName: '3',
thirdName: '550.2',
applicable: '否',
},
],
},
{
code: '2.2', // 对应原子code
firstName: '1375.92',
secondName: '3',
thirdName: '550.2',
children: [
{
code: '2.1.1',
firstName: '125.44',
secondName: '2',
thirdName: '42.56',
},
{
code: '2.1.2',
firstName: '1375.92',
secondName: '3',
thirdName: '550.2',
},
],
},
],
},
{
code: '3',
firstName: '129.696',
secondName: '2',
thirdName: '-60.704',
year: '2016',
children: [
{
code: '2.1', // 对应原子code
firstName: '125.44',
secondName: '2',
thirdName: '42.56',
applicable: '是',
children: [
{
code: '2.1.1',
firstName: '125.44',
secondName: '2',
thirdName: '42.56',
applicable: '是',
},
{
code: '2.1.2',
firstName: '1375.92',
secondName: '3',
thirdName: '550.2',
applicable: '是',
},
],
},
{
code: '2.2', // 对应原子code
firstName: '1375.92',
secondName: '3',
thirdName: '550.2',
children: [
{
code: '2.1.1',
firstName: '125.44',
secondName: '2',
thirdName: '42.56',
},
{
code: '2.1.2',
firstName: '1375.92',
secondName: '3',
thirdName: '550.2',
},
],
},
],
},
];
const option: any = {
records: mockData,
columns,
hierarchyExpandLevel: Infinity,
};
return ;
}
export default CheckboxDemo;
Current Behavior
checked的函数中获取的col和row不正确
Expected Behavior
期望:checked的函数中获取的col和row,这样我能通过col,row获取到当前行的数据,并能处理勾选的逻辑
Environment
- OS:
- Browser:
- Framework:
Any additional comments?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.