Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛[BUG] EditableProTable 只能增加一行 #1726

Closed
dercaft opened this issue Jan 21, 2021 · 7 comments
Closed

🐛[BUG] EditableProTable 只能增加一行 #1726

dercaft opened this issue Jan 21, 2021 · 7 comments

Comments

@dercaft
Copy link

dercaft commented Jan 21, 2021

🐛 bug 描述

EditableProTable 只能增加一行。
在Proform和EditableProtable文档页面中可以增加多行,但把代码复制到我的本地工程中就只能增加一行。

📷 复现步骤

Proform和EditableProTable中可以新增多行

proform

将代码复制添加到我本地工程,就只能新增一行

只能新增一行2

请问这是出了什么问题呢?感觉像是在本地工程中组件的key被赋值成相同的值。
以及antd5.0中,EditableProTable Props recordCreatorProps 没有 newRecordType 这个参数,
会报React does not recognize the newRecordType prop on a DOM element.错误

© 版本信息

🚑 其他信息

@auyo18
Copy link

auyo18 commented Jan 22, 2021

image

@chenshuai2144
Copy link
Contributor

recordCreatorProps={{
          newRecordType: 'dataSource',
          record: () => ({
            id: Date.now(),
          }),
        }}

newRecordType 设置成 dataSource 就可以无限行添加了,但是会导致取消之后有一条新数据

@dercaft
Copy link
Author

dercaft commented Jan 24, 2021

recordCreatorProps={{
          newRecordType: 'dataSource',
          record: () => ({
            id: Date.now(),
          }),
        }}

newRecordType 设置成 dataSource 就可以无限行添加了,但是会导致取消之后有一条新数据

您好,感谢回复。
修改代码后还是只能添加一行,而且有如下问题:

  1. 我这个环境下recordCreatorProps 没有 newRecordType 这个参数,浏览器会报React does not recognize the newRecordType prop on a DOM element.错误

不识别_参数

  1. record: () => ({ id: Date.now(),}), //record这样写时

    会出现

record函数

然后

  1. 新建条目时就会在参数名字段出现“record”,如图

record问题

  1. 浏览器console报错:“Warning: Each child in a list should have a unique "key" prop.”如图:
    key问题

@chenshuai2144
Copy link
Contributor

按照提示来,这个 record 是你新建行的数据,我的主键是id,但是你的不是id,你要用自己的demo来

@chenshuai2144
Copy link
Contributor

我这个环境下recordCreatorProps 没有 newRecordType 这个参数,浏览器会报React does not recognize the newRecordType prop on a DOM element.错误

你要更新版本到最新

@dercaft
Copy link
Author

dercaft commented Jan 30, 2021

我这个环境下recordCreatorProps 没有 newRecordType 这个参数,浏览器会报React does not recognize the newRecordType prop on a DOM element.错误

你要更新版本到最新

更新版本到最新之后可以正常添加新行了,“没有 newRecordType 参数”的报错也消失了,以后我多注意更新版本,感谢您的帮助。

@dercaft dercaft closed this as completed Jan 30, 2021
@liushuhui
Copy link

image
应该更新到哪个版本呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants