如何在休息时刷新管理员中的列表视图 [英] How to refresh a List View in admin on rest
问题描述
我正在尝试在成功执行自定义操作后获取要刷新的列表.
I am trying to get a list to refresh after a custom action was successfully executed.
我在休息教程中使用了管理员的传奇
i used the saga from the admin on rest tutorial
function * actionApproveSuccess () {
yield put(showNotification('Executed'))
yield put(push('/comments'))
// does not refresh, because the route does not change
// react-redux-router also has no refresh() method, like react-router has...
}
我的另一个想法是以某种方式触发列表组件的刷新操作,但我不知道如何访问它或如何将其连接到 ACTION_SUCCESS 事件.
the other idea i had was to somehow trigger the refresh action of the list component, but i have no idea how to access that or how to hook that up to the ACTION_SUCCESS event.
推荐答案
没有办法通过 react router 来刷新路由,那就是 已知问题.Admin-on-rest 的 List
组件具有 自己的刷新机制,但没有提供API.
There is no way to refresh a route via react router, and that's a known problem. Admin-on-rest's List
component has its own refresh mechanism, but offers no API for it.
我的建议是使用基于 admin-on-rest 的自定义
组件.如果你找到一种方法来公开 refresh
操作,请随时在 aor 存储库上打开一个 PR!
My advice would be to use a custom <List>
component based on admin-on-rest's one. And if you find a way to expose the refresh
action, feel free to open a PR on the aor repository!
这篇关于如何在休息时刷新管理员中的列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!