【发布时间】:2019-10-17 19:03:52
【问题描述】:
在角度数据表中实现服务器端分页。表格未正确呈现。我们必须更改后端的响应才能使数据表正常工作? 下面我提供我尝试过的内容。如果有任何机构尝试使用数据表进行角度分析,请指导我
<div class="container">
<table datatable [dtOptions]="dtOptions" class="row-border hover" >
<thead>
<tr>
<th>Id</th>
<th>First Name</th>
<th>Last Name</th>
<th>Age</th>
<th>Country</th> >
</tr>
</thead>
<tbody>
<tr *ngFor="let user of users">
<td>{{ user.id }}</td>
<td>{{ user.firstName }}</td>
<td>{{ user.lastName }}</td>
<td>{{ user.age }}</td>
<td>{{ user.country }}</td>
</tr>
</tbody>
</table>
</div>
dtOptions: any = {}
@Input() users: User[]
constructor() { }
ngOnInit() {
this.dtOptions = {
data: [],
pagingType: 'full_numbers',
pageLength: 2,
serverSide: true,
processing: true,
responsive: true
}
}
ngOnChanges() {
if (this.matchBids) {
this.dtOptions.data = this.matchBids
}
}
【问题讨论】:
标签: angular datatable pagination