【发布时间】:2018-08-17 13:08:41
【问题描述】:
对于我正在构建的数据表,我需要使用动态标题(单击按钮时,不同的数据会加载到表中并且标题需要更改)。我正在使用它在软删除用户和普通用户之间切换(删除列变为恢复列)。
更新行,表格的工作方式如下所述:
this.rows = [...this.rows];
更新我的专栏是另一回事。我使用this.columns = [...this.columns]; 以同样的方式尝试过,但这不会刷新表头。现在我所拥有的是一个表格,其中标题仅在后台刷新时才会更改,我似乎无法找到自己触发刷新的方法。我的桌子是这样的:
<ngx-datatable
[rows]="rows"
[columns]="columns"
[columnMode]="'flex'"
[sortType]="'single'"
[headerHeight]="50"
[footerHeight]="50"
[selected]="selected"
(select)='onSelect($event)'
[selectionType]="'checkbox'"
[selectAllRowsOnPage]="true"
[limit]="rowLimit"
[reorderable]="false"
[rowHeight]="'auto'" style="width: 100%">
</ngx-datatable>
这是我更新列的代码:
this.route.params.subscribe(params => {
this.state = params.state;
if (this.state === 'deleted') {
this.columns[columnIndex].name = 'Recover';
} else if (this.state === 'notactivated') {
this.columns[columnIndex].name = 'Delete';
}
【问题讨论】:
标签: angular ngx-datatable