我有一个删除路由 Inertia.js,这样当我删除一个项目时,它会重定向回我所在的页面。但是,这并不是在 Inertia destroy 路由中调用 onSuccess() 函数。
示例.vue
deleteSubmit(id) {
this.accountsDataTable.destroy();
Inertia.destroy(route('installers.destroy', {id: id}), {}, {
preserveState: true,
onSuccess: () => {
this.accountsDataTable = $('#table').DataTable({
columnDefs: [{
target: 1
}]
});
}
})
},
ExampleController.php
//Validate the request
//Create the installer
//Redirect back on success
return redirect()->route('installers.index')->with('success', 'Installer was successfully deleted.');
但是,数据表没有按照我想要的方式重新创建。这是之前的样子:
正确的图像
之后的情况是这样的:
图片错误
我尝试将控制器代码更改为:
return redirect()->back()->with('success', 'Installer was successfully deleted');
但是数据表仍然没有按应有的方式显示。
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号