【发布时间】:2016-09-21 13:04:58
【问题描述】:
我正在尝试使用 angular2-data-table 模块 (https://www.gitbook.com/book/swimlane/angular2-data-table/details) 来创建我的表。分页和排序应通过服务器处理。要从后端加载和设置我的数据,我使用以下方法:
this.loadData('sortColumn', 'ASC', this.currentPage, this.options.limit)
.subscribe(ratings => {
this.rows = [];
this.rows.push(...ratings.ratings);
//For testing
this.maxRows = 10;
this.options.count = 10;
if (this.maxRows < this.options.limit) {
this.endRow = this.maxRows;
}
}, error => this.errorMessage = <any>error);}
this.rows 是我绑定到数据表模板的变量:
<datatable class="rating_table" [rows]='rows' [options]='options' (onRowClick)='onRowClick($event)' (onPageChange)='onPage($event)'>
我的问题是当我加载第一页时,数据绑定有效并且在表格中显示了我的评级,但是当我加载第二页时 this.rows 设置为 rating.ratings 对象,但表格不刷新旧收视率依然可见。谁能帮帮我我不知道为什么桌子不刷新。
【问题讨论】:
标签: angular typescript pagination