【发布时间】:2019-02-16 04:58:27
【问题描述】:
在 List 模块上,我创建了一个批量操作按钮,通过调用自定义操作来生成 PDF。
问题是<Datagrid> 复选框在执行操作后不会取消选中。
这是我的自定义操作:
export const print = (resource, ids, data) => ({
type: DOWNLOAD,
payload: {
id: ids.length === 1 ? ids[0] : ids,
data,
},
meta: {
resource: resource,
fetch: PRINT,
onFailure: {
notification: {
body: 'ra.notification.http_error',
level: 'warning',
},
},
},
});
这是我的按钮:
class PrintBulkButton extends React.Component {
handleClick = () => {
const { basePath, options, print, resource, selectedIds } = this.props;
print(resource, selectedIds, options, basePath);
};
render() {
return (
<Button {...sanitizeRestProps(this.props)} onClick={this.handleClick}>
{this.props.icon}
</Button>
);
}
}
我正在使用 react-admin 2.3.0,但它也不适用于以前的版本。
我认为复选框没有被取消选中,因为我调用的服务不会更新数据。 我说的对吗?
我是否必须调用其他服务或操作来取消选中它们,或者我错过了什么?
【问题讨论】:
标签: datagrid react-admin