ant-design / ant-design/pro-components

🐛[BUG]EditableProTable添加name属性无法新增子列?

Open
#8,316 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

### 🐛 bug 描述

EditableProTable需要和表格外的数据进行联动,使用`name="table"`属性结合完成数据联动,
但是addEditRecord()方法新增子项失效,无法新增子项且会删除已存在子项,注释掉`name="table"`后新增子项就可以实现。

### 📷 复现步骤

`
// 新增子项触发方法
}
style={{
alignSelf: 'flex-end',
}}
onClick={() => {
actionRef.current?.addEditRecord?.(
{
id: (Math.random() * 1000000).toFixed(0),
title: '新的一行',
parentKey: record.id,
},
{
newRecordType: 'dataSource',
parentKey: record.id,
recordKey: 'id',
},
);
}}
>`

### © 版本信息

- "@ant-design/pro-components"版本: [2.4.4]
- "@umijs/max": [4.0.66]
- 浏览器环境[Chrome]
- 开发环境 [windows]

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start with the EditableProTable and its addEditRecord entry point. Reproduce the reported case using name="table", ProFormDependency, and the shown nested-record options, then compare it with the case where name is removed. Done means addEditRecord adds the child row without deleting existing child rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.