diff --git a/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts b/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts index 111a27b636..19c82bf129 100644 --- a/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts +++ b/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts @@ -1427,6 +1427,31 @@ describe('DocumentList', () => { expect(documentList.reload).toHaveBeenCalled(); }); + it('should not show loading state if pagination is updated with merge setting as true', fakeAsync (() => { + spyFolderNode = spyOn(documentListService, 'loadFolderByNodeId').and.callFake(() => + of(new DocumentLoaderNode(null, { + list: { + pagination: {}, + entries: mockPreselectedNodes + } + })) + ); + fixture.detectChanges(); + const fakeDatatableRows = [ + new ShareDataRow(mockPreselectedNodes[0], contentService, null), + new ShareDataRow(mockPreselectedNodes[1], contentService, null) + ]; + documentList.data.setRows(fakeDatatableRows); + documentList.updatePagination({ + maxItems: 10, + skipCount: 0, + merge: true + }); + fixture.detectChanges(); + + expect(element.querySelector('#adf-document-list-loading')).toBe(null); + })); + it('should NOT reload data on first call of ngOnChanges', () => { spyOn(documentList, 'reload').and.stub(); diff --git a/lib/content-services/src/lib/document-list/components/document-list.component.ts b/lib/content-services/src/lib/document-list/components/document-list.component.ts index 7642a4f4ff..df702a5040 100644 --- a/lib/content-services/src/lib/document-list/components/document-list.component.ts +++ b/lib/content-services/src/lib/document-list/components/document-list.component.ts @@ -550,12 +550,12 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte } } - reload() { + reload(hideLoadingSpinner = false) { this.resetSelection(); - this.reloadWithoutResettingSelection(); + this.reloadWithoutResettingSelection(hideLoadingSpinner); } - reloadWithoutResettingSelection() { + reloadWithoutResettingSelection(hideLoadingSpinner = false) { if (this.node) { if (this.data) { this.data.loadPage(this.node, this._pagination.merge, null); @@ -565,7 +565,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte this.syncPagination(); this.onDataReady(this.node); } else { - this.loadFolder(); + this.loadFolder(hideLoadingSpinner); } } @@ -713,8 +713,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte } } - loadFolder() { - if (!this._pagination.merge) { + loadFolder(hideLoadingSpinner = false) { + if (!hideLoadingSpinner) { this.setLoadingState(true); } @@ -944,9 +944,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte updatePagination(requestPaginationModel: RequestPaginationModel) { this._pagination.maxItems = requestPaginationModel.maxItems; - this._pagination.merge = requestPaginationModel.merge; this._pagination.skipCount = requestPaginationModel.skipCount; - this.reload(); + this.reload(requestPaginationModel.merge); } private syncPagination() { diff --git a/lib/core/src/lib/pagination/infinite-pagination.component.spec.ts b/lib/core/src/lib/pagination/infinite-pagination.component.spec.ts index c48bbf9ae5..5921212140 100644 --- a/lib/core/src/lib/pagination/infinite-pagination.component.spec.ts +++ b/lib/core/src/lib/pagination/infinite-pagination.component.spec.ts @@ -174,7 +174,7 @@ describe('InfinitePaginationComponent', () => { loadMoreButton.triggerEventHandler('click', {}); }); - it('should trigger the loadMore event with merge false to reload all the elements', (done) => { + it('should trigger the loadMore event with merge true to reload all the elements', (done) => { pagination = {maxItems: 444, skipCount: 25, totalItems: 55, hasMoreItems: true}; component.target.pagination.next(pagination); @@ -184,7 +184,7 @@ describe('InfinitePaginationComponent', () => { changeDetectorRef.detectChanges(); component.loadMore.subscribe((newPagination: RequestPaginationModel) => { - expect(newPagination.merge).toBe(false); + expect(newPagination.merge).toBe(true); done(); }); @@ -222,7 +222,7 @@ describe('InfinitePaginationComponent', () => { skipCount: 0, maxItems: 50, hasMoreItems: false, - merge: false + merge: true }); }); @@ -237,7 +237,7 @@ describe('InfinitePaginationComponent', () => { maxItems: 14, skipCount: 0, hasMoreItems: false, - merge: false + merge: true }); }); diff --git a/lib/core/src/lib/pagination/infinite-pagination.component.ts b/lib/core/src/lib/pagination/infinite-pagination.component.ts index f7e5331f28..32a61ce8f7 100644 --- a/lib/core/src/lib/pagination/infinite-pagination.component.ts +++ b/lib/core/src/lib/pagination/infinite-pagination.component.ts @@ -109,7 +109,7 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio onLoadMore() { this.requestPaginationModel.skipCount = 0; - this.requestPaginationModel.merge = false; + this.requestPaginationModel.merge = true; this.requestPaginationModel.maxItems += this.pageSize;