Hello,
I have defined a click handler that is called when a user single-clicks on a node in the document list. I thought that this function is called only once but the more often I click on a folder node, the more often the handler is called. On the first click it is called twice, on the second it's called 6 times, on the third 10 times, etc.. (These numbers are not consistent and different every time I refresh the page but it always starts with 2 calls)
Here is the HTML:
<alfresco-document-list
#documentList
[creationMenuActions]="false"
[currentFolderId]="currentFolderId"
(error)="onNavigationError($event)"
(success)="resetError()"
(preview)="showFile($event)"
(nodeClick)="onNodeClicked($event)"
(permissionError)="handlePermissionError($event)"
[navigationMode]="'click'">
</alfresco-document-list>
and this is my click handler:
onNodeClicked(event: any): void {
this.stopPropagation(event);
console.log('node clicked');
}
private stopPropagation(event: any): void {
event = event || window.event;
if (typeof event.stopPropagation !== 'undefined') {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
}The problem exists with or without calling the stopPropagation() function and is present on IE, Firefox and Chrome.
Do you have an idea how I can get onNodeClicked() called only once when a user clicks on a row of the document list?