【发布时间】:2018-08-17 05:13:48
【问题描述】:
ngOnInit() {
this.dtOptions = {
pagingType: 'full_numbers',
pageLength: 2
};
this.dtOptions = {
pagingType: 'full_numbers',
pageLength: 2
};
this.allservice.getUrl(this.listUserUrl)
.subscribe(data=>{
this.listUser=data.responseContents
});
}
## angular.json:
"styles": [
"src/styles.css",
"node_modules/datatables.net-dt/css/jquery.dataTables.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.js",
"node_modules/datatables.net/js/jquery.dataTables.js"
]
<table datatable [dtOptions]="dtOptions" class="row-border hover">
<thead>
<tr>
<th class="text-center width-10"> Name
</th>
<th class="text-center"> User Name
</th>
</tr>
</thead>
<tbody>
<tr *ngFor = "let i = index ; let x of listUser ">
<td class="text-center">{{x.name}}</td>
<td>{{x.username}}</td>
</tr>
</tbody>
</table>
在这个我试图在第一次加载时使用数据表我在表中获取数据但是如果我做任何排序 r 过滤器,分页它显示没有找到数据。我不知道我在哪里犯了错误,任何人都可以帮助解决这个问题.
【问题讨论】:
-
在
stackblitz中提供实时代码
标签: angular angular-datatables