mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-1488] reset selection on Document List data change (#2341)
* reset selection on data change * unit tests * fix unit tests
This commit is contained in:
committed by
Eugenio Romano
parent
3c1729b960
commit
43277148b2
@@ -255,6 +255,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
||||
this.loadFolderByNodeId(changes.currentFolderId.currentValue);
|
||||
} else if (this.data) {
|
||||
if (changes.node && changes.node.currentValue) {
|
||||
this.resetSelection();
|
||||
this.data.loadPage(changes.node.currentValue);
|
||||
} else if (changes.rowFilter) {
|
||||
this.data.setFilter(changes.rowFilter.currentValue);
|
||||
@@ -269,6 +270,8 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
||||
|
||||
reload() {
|
||||
this.ngZone.run(() => {
|
||||
this.resetSelection();
|
||||
|
||||
if (this.folderNode) {
|
||||
this.loadFolder();
|
||||
} else if (this.currentFolderId) {
|
||||
@@ -399,6 +402,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
||||
// gets folder node and its content
|
||||
loadFolderByNodeId(nodeId: string) {
|
||||
this.loading = true;
|
||||
this.resetSelection();
|
||||
|
||||
if (nodeId === '-trashcan-') {
|
||||
this.loadTrashcan();
|
||||
@@ -425,6 +429,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
||||
|
||||
loadFolderNodesByFolderNodeId(id: string, maxItems: number, skipCount: number): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.resetSelection();
|
||||
this.documentListService
|
||||
.getFolder(null, {
|
||||
maxItems: maxItems,
|
||||
@@ -454,6 +459,10 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
||||
|
||||
}
|
||||
|
||||
resetSelection() {
|
||||
this.selection = [];
|
||||
}
|
||||
|
||||
private loadTrashcan(): void {
|
||||
const options = {
|
||||
include: [ 'path', 'properties' ],
|
||||
|
Reference in New Issue
Block a user