ant-design: getFieldDecorator with nested field format is not allowing arrays of objects to setFieldsValue
Version
2.9.1
Environment
Mac OS, chrome, react ^15.4.2
Reproduction link
http://codepen.io/ffab00/pen/wdGrVQ
Steps to reproduce
When adding a getFieldDecorator for a field inside array of objects it prevents setFieldsValue from saving. This makes it hard to create repeatable sections.
Open codepen link,
Click add button multiple times,
it will not add more section,
Remove line 36 {form.getFieldDecorator('pumps[' + index + '].make', { })(<Input />)}
And sections will be added
What is expected?
Expected to be able to add multiple sections of fields in array field.
What is actually happening?
New objects are not pushed to array by setFieldsValue
when getFieldDecorator
for nested field is present in render
I was trying to create a form with repeatable groups of fields (array of objects). Would appreciate working examples. Followed this example initially https://github.com/ant-design/ant-design/blob/master/components/form/demo/dynamic-form-item.md but extended it to allow multiple fields in each array/object.
May be related to https://github.com/react-component/form/pull/48
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (4 by maintainers)
这个问题解决了么?或者有什么办法,能让一个数组源的项目能够展示出来,并且可以动态的增删呢? 急~
I got a way to solve this:
Now removing an item from array doesn’t work