` ngOnInit(): void { this.displayTable = true this.dtOptions = { ajax: 'http://localhost:8080/amp/toll/get', 选择:真实, dom: 'Bfrtpl', 列: [{ 标题:'Srno', 数据:'id' }, { title: '电话号码', 数据:“收费名称” }, { 标题:'位置', 数据:'位置' } , { title: '区', 数据:'区' }, { 标题:'状态', 数据:“状态” }, { title: '密码', 数据:'密码' } ], 处理:真实, 服务器端:真实, 订购:真实, 长度:真实, 纽扣: [ { 类:'按钮', 行动:()=> { 这个.showModal() } }, { 类:'编辑', 扩展:'选择', 行动:()=> { this.showModal()
}
},
{
extend: 'selected',
action: () => {
this.deletetoll()
location.reload()
},
enable: false
},
{
action:()=>{
this.reload()
}
}
],
rowCallback: (row: Node, data: any[] | Object, index: number) => {
// const self = this;
$('td', row).off('click');
$('td', row).on('click', () => {
this.someClickHandler(data);
});
return row;
}
}`
}
删除时需要重新加载数据而不加载页面 我们删除记录后删除我们只需要刷新数据而不需要重新加载页面或渲染
https://l-lin.github.io/angular-datatables/#/basic/new-server-side