diff --git a/libs/angular-accelerator/src/lib/components/data-list-grid/data-list-grid.component.ts b/libs/angular-accelerator/src/lib/components/data-list-grid/data-list-grid.component.ts index eb4d3a33..67094f7f 100644 --- a/libs/angular-accelerator/src/lib/components/data-list-grid/data-list-grid.component.ts +++ b/libs/angular-accelerator/src/lib/components/data-list-grid/data-list-grid.component.ts @@ -112,6 +112,7 @@ export class DataListGridComponent extends DataSortBase implements OnInit, DoChe return this._data$.getValue() } set data(value: RowListGridData[]) { + this.resetPage() this._originalData = [...value] this._data$.next([...value]) } @@ -376,6 +377,11 @@ export class DataListGridComponent extends DataSortBase implements OnInit, DoChe this.pageChanged.emit(page) } + resetPage() { + this.page = 0 + this.pageChanged.emit(this.page) + } + fieldIsTruthy(object: any, key: any) { return !!this.resolveFieldData(object, key) } diff --git a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.ts b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.ts index e1a7a479..232c3d5e 100644 --- a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.ts +++ b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.ts @@ -43,6 +43,7 @@ export class DataTableComponent extends DataSortBase implements OnInit { return this._rows$.getValue() } set rows(value: Row[]) { + this.resetPage() this._rows$.next(value) } _selection$ = new BehaviorSubject([]) @@ -338,6 +339,7 @@ export class DataTableComponent extends DataSortBase implements OnInit { this.filters = filters } this.filtered.emit(filters) + this.resetPage() } getSelectedFilters(columnId: string): string[] | undefined { @@ -383,6 +385,11 @@ export class DataTableComponent extends DataSortBase implements OnInit { this.pageChanged.emit(page) } + resetPage() { + this.page = 0 + this.pageChanged.emit(this.page) + } + fieldIsTruthy(object: any, key: any) { return !!ObjectUtils.resolveFieldData(object, key) }