From 91657c2324c01ea84eba66a2cc3ab5cb25976a90 Mon Sep 17 00:00:00 2001 From: "jeremy.smartt" Date: Tue, 17 Jul 2018 15:23:34 -0700 Subject: [PATCH 1/2] fix(datatable): Fix for ExpressionChangedAfterItHasBeenCheckedError on datatable demo with pagination --- .../components/data-table/data-table.component.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/components/components/data-table/data-table.component.ts b/src/app/components/components/data-table/data-table.component.ts index d0430cf4c6..3ec1c73692 100644 --- a/src/app/components/components/data-table/data-table.component.ts +++ b/src/app/components/components/data-table/data-table.component.ts @@ -153,19 +153,19 @@ export class DataTableDemoComponent implements OnInit { this.filter(); } - filter(): void { + async filter(): Promise { let newData: any[] = this.data; - let excludedColumns: string[] = this.columns + let excludedColumns: string[] = await this.columns .filter((column: ITdDataTableColumn) => { return ((column.filter === undefined && column.hidden === true) || (column.filter !== undefined && column.filter === false)); }).map((column: ITdDataTableColumn) => { return column.name; }); - newData = this._dataTableService.filterData(newData, this.searchTerm, true, excludedColumns); + newData = await this._dataTableService.filterData(newData, this.searchTerm, true, excludedColumns); this.filteredTotal = newData.length; - newData = this._dataTableService.sortData(newData, this.sortBy, this.sortOrder); - newData = this._dataTableService.pageData(newData, this.fromRow, this.currentPage * this.pageSize); + newData = await this._dataTableService.sortData(newData, this.sortBy, this.sortOrder); + newData = await this._dataTableService.pageData(newData, this.fromRow, this.currentPage * this.pageSize); this.filteredData = newData; } From 740149629dd9693b8c5d306629d7d12836e471bd Mon Sep 17 00:00:00 2001 From: "jeremy.smartt" Date: Wed, 18 Jul 2018 10:04:10 -0700 Subject: [PATCH 2/2] Update documentation for filter to use async --- .../components/data-table/data-table.component.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/components/components/data-table/data-table.component.html b/src/app/components/components/data-table/data-table.component.html index fa28a86d7c..ad7bcce375 100644 --- a/src/app/components/components/data-table/data-table.component.html +++ b/src/app/components/components/data-table/data-table.component.html @@ -323,19 +323,19 @@

No results to display.

// .. do something with event.row } - filter(): void { + async filter(): Promise { let newData: any[] = this.data; - let excludedColumns: string[] = this.columns + let excludedColumns: string[] = await this.columns .filter((column: ITdDataTableColumn) => { return ((column.filter === undefined && column.hidden === true) || (column.filter !== undefined && column.filter === false)); }).map((column: ITdDataTableColumn) => { return column.name; }); - newData = this._dataTableService.filterData(newData, this.searchTerm, true, excludedColumns); + newData = await this._dataTableService.filterData(newData, this.searchTerm, true, excludedColumns); this.filteredTotal = newData.length; - newData = this._dataTableService.sortData(newData, this.sortBy, this.sortOrder); - newData = this._dataTableService.pageData(newData, this.fromRow, this.currentPage * this.pageSize); + newData = await this._dataTableService.sortData(newData, this.sortBy, this.sortOrder); + newData = await this._dataTableService.pageData(newData, this.fromRow, this.currentPage * this.pageSize); this.filteredData = newData; } }