我需要拥有我的p-table
的选定页面成为最后一页。
我能够得到我的表对象:
@ViewChild('myTable') myTable: DataTable;
ngOnInit() {
this.subService.subsUpdated.subscribe(result => {
this.fetchSubcontracts();
});
this.appForm.subAdded.subscribe(result => {
this.added = 4;
this.fetchSubs();
});
}
我尝试绑定(bind)
[first]
和 [paginatorPosition]
我的 p-table
上的属性到一个属性(property),但没有奏效。<p-table #myTable
[value]="subs"
sortMode="multiple"
selectionMode="single"
(onRowSelect)="onRowSelect($event)"
(onRowUnselect)="onRowUnselect($event)"
[(selection)]="selectedSub"
[columns]="columns"
dataKey="id"
[paginator]="subs.length > 0"
[rows]="5"
[first]="added"
>
最佳答案
这对我有用:
@ViewChild('dt', { static: false }) table: Table;
this.table.first = Math.floor(this.table.totalRecords / this.table.rows) * this.table.rows;
this.table.firstChange.emit(this.table.first);
this.table.onLazyLoad.emit(this.table.createLazyLoadMetadata());
关于angular - 将页面选择设置为 PrimeNG p-table 的最后一页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51792559/