Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(datatable): Fix for ExpressionChangedAfterItHasBeenCheckedError on datatable demo with pagination #1198

Merged
merged 6 commits into from
Aug 3, 2018
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -324,19 +324,19 @@ <h3>No results to display.</h3>
// .. do something with event.row
}

filter(): void {
async filter(): Promise<void> {
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;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/app/components/components/data-table/data-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,19 @@ export class DataTableDemoComponent implements OnInit {
this.filter();
}

filter(): void {
async filter(): Promise<void> {
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;
}

Expand Down