Skip to content
This repository has been archived by the owner on Mar 2, 2022. It is now read-only.

Provides EditableTable which support form api #319

Open
1 task
zombieJ opened this issue Mar 4, 2019 · 5 comments
Open
1 task

Provides EditableTable which support form api #319

zombieJ opened this issue Mar 4, 2019 · 5 comments
Assignees

Comments

@zombieJ
Copy link
Member

zombieJ commented Mar 4, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

Currently Table with editable is hard integrated with form api

What does the proposed API look like?

getFieldDecorator('records', { initialValue: [] })(
  <EditableTable />
);

update:

  • Support table cell edit
  • Support row level edit
  • Support form api integration
@afc163
Copy link
Member

afc163 commented Mar 4, 2019

这个组合太复杂了吧...

@zombieJ
Copy link
Member Author

zombieJ commented Mar 4, 2019

其实还行……
主要就是处理 onChange 和 dataSource 的联动,因为我们有 dataIndex 正好可以复用了。现在自己包了一个 EditableTable:

tableColumns = [
    {
      title: 'Field 1',
      dataIndex: 'field_1',
      key: 'field_1',
      width: '30%',
      renderItem: <Input />,
    },
    {
      title: 'Field 2',
      dataIndex: 'field_2',
      key: 'field_2',
      width: '30%',
      renderItem: <Select style={{ width: '100%' }}>
        <Select.Option value="value_1">数值 1</Select.Option>
        <Select.Option value="value_2">数值 2</Select.Option>
      </Select>,
    },
];

getFieldDecorator('table_records', { initialValue: [] })(
  <EditableTable columns={this.tableColumns}  />
)

@bobby1991qw
Copy link

确实挺复杂的,我们现在也碰到这样的交互。一个表单里面有一个editableTable。变成form里面包了table,table里又包了form。而且在编辑的时候,某个column可能对应不止1个字段。比如地址:编辑的时候,要选择省市,填写详细地址,和选择地图经纬度。

@paranoidjk
Copy link

从云凤蝶这边接到业务需求反馈来看,这种形态的设计稿非常高频,我猜是因为这本质是就是在编辑后端的一对多的关联模型,而一对多在后端非常常见

@zombieJ
Copy link
Member Author

zombieJ commented Apr 9, 2020

Move to pro-table

@zombieJ zombieJ transferred this issue from ant-design/ant-design Apr 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants