![](/img/trans.png)
[英]How can i save pagination, sort, search state of a table in Angular 8? I am using angular2-datatable
[英]How can i implement auto slide on table pagination using Angular 6?
是否可以使用Carousel並利用我在桌子上的分頁或自動滾動表頁面上的任何內容?
我嘗試過旋轉木馬,但似乎根本不起作用。
dashboard.component.html
<div class="row" >
<div eds-tile class="xl-12" style="width: 700px">
<eds-tile-title>User on Shift</eds-tile-title>
<ngb-carousel *ngIf="carousel">
<ng-template ngbSlide>
<table class="table">
<thead>
<tr>
<th *ngFor="let col of tablePresetColumns">
{{col.content}}
</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<div *ngIf='!tablePresetData' class="loading large"></div>
<tr *ngFor="let row of tablePresetData | paginate: { itemsPerPage: 11, currentPage: p }; ">
<td *ngFor="let cell of row"> {{cell.content}}</td>
</tr>
</tbody>
<pagination-controls (pageChange)="p = $event"></pagination-controls>
</table>
</ng-template>
</ngb-carousel>
</div>
然后,我的dashboard.component.ts
constructor(private activityService: ActivityService, private router: Router) { }
public apiData;
public carousel;
public tables;
ngOnInit() {
this.carousel = [1,2,3,4,5,6,7,8,9,10,11,12].map(()=> 'p:number = ${Math.random()}');
this.activityService.getAchievement().subscribe((res) => {
this.apiData = res;
var ids = [['Username', 1], ['Role', 2], ['today', 3], ['weekly', 4], ['monthly', 5], ['yearly', 6]],
result = Object.keys(res).map(o => ids.map(([key, id]) => ({ id, content: res[o][key] })));
this.tablePresetData = result;
})
如果有人能提供幫助,我會得到獎金,謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.