mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-1677] fix issues with paging (#2446)
* fix issues with paging * update unit test
This commit is contained in:
committed by
Eugenio Romano
parent
48f0ccfc4f
commit
7894d687ab
@@ -975,8 +975,10 @@ describe('DocumentList', () => {
|
|||||||
|
|
||||||
it('should reset pagination when switching sources', () => {
|
it('should reset pagination when switching sources', () => {
|
||||||
spyOn(documentList, 'resetPagination').and.callThrough();
|
spyOn(documentList, 'resetPagination').and.callThrough();
|
||||||
documentList.loadFolderByNodeId('-trashcan-');
|
|
||||||
documentList.loadFolderByNodeId('-sites-');
|
documentList.ngOnChanges({currentFolderId: new SimpleChange(null, '-trashcan-', false)});
|
||||||
|
documentList.ngOnChanges({currentFolderId: new SimpleChange(null, '-sites-', false)});
|
||||||
|
|
||||||
expect(documentList.resetPagination).toHaveBeenCalledTimes(2);
|
expect(documentList.resetPagination).toHaveBeenCalledTimes(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -242,6 +242,9 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
|||||||
if (changes.folderNode && changes.folderNode.currentValue) {
|
if (changes.folderNode && changes.folderNode.currentValue) {
|
||||||
this.loadFolder();
|
this.loadFolder();
|
||||||
} else if (changes.currentFolderId && changes.currentFolderId.currentValue) {
|
} else if (changes.currentFolderId && changes.currentFolderId.currentValue) {
|
||||||
|
if (changes.currentFolderId.previousValue !== changes.currentFolderId.currentValue) {
|
||||||
|
this.resetPagination();
|
||||||
|
}
|
||||||
if (!this.hasCustomLayout) {
|
if (!this.hasCustomLayout) {
|
||||||
this.setupDefaultColumns(changes.currentFolderId.currentValue);
|
this.setupDefaultColumns(changes.currentFolderId.currentValue);
|
||||||
}
|
}
|
||||||
@@ -404,9 +407,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
|||||||
// gets folder node and its content
|
// gets folder node and its content
|
||||||
loadFolderByNodeId(nodeId: string) {
|
loadFolderByNodeId(nodeId: string) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
this.resetSelection();
|
this.resetSelection();
|
||||||
this.resetPagination();
|
|
||||||
|
|
||||||
if (nodeId === '-trashcan-') {
|
if (nodeId === '-trashcan-') {
|
||||||
this.loadTrashcan();
|
this.loadTrashcan();
|
||||||
@@ -423,6 +424,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
|||||||
.getFolderNode(nodeId).then(node => {
|
.getFolderNode(nodeId).then(node => {
|
||||||
this.folderNode = node;
|
this.folderNode = node;
|
||||||
this.currentFolderId = node.id;
|
this.currentFolderId = node.id;
|
||||||
|
this.skipCount = 0;
|
||||||
this.currentNodeAllowableOperations = node['allowableOperations'] ? node['allowableOperations'] : [];
|
this.currentNodeAllowableOperations = node['allowableOperations'] ? node['allowableOperations'] : [];
|
||||||
this.loadFolderNodesByFolderNodeId(node.id, this.pageSize, this.skipCount).catch(err => this.error.emit(err));
|
this.loadFolderNodesByFolderNodeId(node.id, this.pageSize, this.skipCount).catch(err => this.error.emit(err));
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user