ant-design / ant-design/pro-components
🧐[问题]EditableProTable的getRowsData()方法没法获取到全部行的数据
- 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
### 🧐 问题描述
editableFormRef.current.getRowsData()方法获取到的数据不完整,体现在这2方面:
1. EditableProTable部分行可以编辑时,只能获取到正在编辑中的行数据。就比如一共有3行数据,只编辑第二行时,getRowsData()返回的是一个长度为1的数组,这个数组是编辑中的第二行数据。
2. getRowsData()返回的行数据只能包含editable为true的column,这我倒是可以理解。但是rowKey那一列一般都是唯一键,不需要设置editable为true,因为这个原因返回的行数据不包括rowKey,这样没法根据rowKey知道第1步返回的数据是哪一行的数据。
### 💻 示例代码
改进方法:
1. getRowsData()返回的数据长度和顺序跟组件的value保持一致,没在编辑中的行值为null或者undefined,编辑中的数据返回表单的值。
2. getRowsData()返回的数据包括rowKey,不管rowKey这个值有没有在columns定义以及是否为editbale
### 🚑 其他信息
Contributor guide
Research direction
Locate the EditableProTable implementation of editableFormRef.current.getRowsData() and compare its result with the component's value and currently edited rows. Reproduce the reported three-row case, then verify that all rows retain their order and that the rowKey is included in the returned data.
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