[英]Angular - datatable redraw table with new data
i am facing an issue with the angular datatable redraw thing.我正面临 angular 数据表重绘的问题。
https://stackblitz.com/edit/angular-6-angular-way-tutorial-pagination-not-working-13-k1hag7 https://stackblitz.com/edit/angular-6-angular-way-tutorial-pagination-not-working-13-k1hag7
this is the example of the problem.这是问题的例子。 Here the API call is done. API 调用到此完成。
plugin Docs - https://l-lin.github.io/angular-datatables/#/welcome插件文档 - https://l-lin.github.io/angular-datatables/#/welcome
you have to destroy the table before reload data您必须在重新加载数据之前销毁表
this.dtElement.dtInstance.then((dtInstance: DataTables.Api) => {
// Destroy the table first
dtInstance.destroy();
// Call the dtTrigger to rerender again
this.dtTrigger.next();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.