我有以下Edit
组件:
const UserEdit = (props) => (
<Edit {...props}>
<TabbedForm>
<FormTab label="Main">
<TextInput source="var1" />
<TextInput source="var2" />
<TextInput source="var3" />
</FormTab>
<FormTab label="Images">
<ImageUploadComponant />
<ReferenceManyField label="Images" reference="images" target="user_id">
<Datagrid>
<ImageField source="url" />
<DeleteButton />
</Datagrid>
</ReferenceManyField>
</FormTab>
</TabbedForm>
</Edit>
);
ImageUploadComponant
是一个使用户能够上传文件的组件,它会在API上创建一个与ReferenceManyField
相关的新对象:
class ImageUpload extends Component {
onDrop = async files => {
/* Uploading the file */
};
render() {
return (
/* A componant with an upload field */
);
}
}
ImageUpload.propTypes = {
push: PropTypes.func,
record: PropTypes.object,
showNotification: PropTypes.func,
};
export default connect(null, {
showNotification: showNotificationAction,
push: pushAction,
})(ImageUpload);
在/* Uploading the file */
阻止之后,我想刷新ReferenceManyField
,以便显示新上传的图片。
我想我必须放一些redux / sagas消息,但我没有设法执行它。有什么想法吗?