07-18-2017 03:35 AM
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?
07-18-2017 03:38 AM
The double-click issue with DataTable and DocumentList components has been fixed with ADF 1.6.1
07-18-2017 03:48 AM
Thanks for your reply. I am using ADF 1.6.1, at least that's what package.json says:
"ng2-activiti-analytics": "1.6.1",
"ng2-activiti-diagrams": "1.6.1",
"ng2-activiti-form": "1.6.1",
"ng2-activiti-processlist": "1.6.1",
"ng2-activiti-tasklist": "1.6.1",
"ng2-alfresco-core": "1.6.1",
"ng2-alfresco-datatable": "1.6.1",
"ng2-alfresco-documentlist": "1.6.1",
"ng2-alfresco-login": "1.6.1",
"ng2-alfresco-search": "1.6.1",
"ng2-alfresco-social": "1.6.1",
"ng2-alfresco-tag": "1.6.1",
"ng2-alfresco-upload": "1.6.1",
"ng2-alfresco-userinfo": "1.6.1",
"ng2-alfresco-viewer": "1.6.1",
"ng2-alfresco-webscript": "1.6.1",
"ng2-charts": "1.6.0",
And my node version is 6.11.1
07-18-2017 03:59 AM
Ok, thanks for the clarification. Could you please try the same with the native DOM events the Document List supports? This is mainly just using "(node-click)" in your case.
07-18-2017 04:15 AM
The result is the same with this HTML:
<div (node-click)="onNodeClicked($event)">
<div>
<alfresco-document-list
#documentList
[creationMenuActions]="false"
[currentFolderId]="currentFolderId"
(error)="onNavigationError($event)"
(success)="resetError()"
(preview)="showFile($event)"
(permissionError)="handlePermissionError($event)"
[navigationMode]="'click'">
</alfresco-document-list>
</div>
</div>
Maybe I get this behaviour because I am using the ADF example application from ADF 101 - Getting Started with Alfresco Application Development Framework. This is how I installed it:
npm install -g yo
npm install -g generator-ng2-alfresco-app
yo ng2-alfresco-app
Is it possible that I have an older version of ADF installed despite the version numbers in package.json?
07-18-2017 04:17 AM
It might have an even subscription leak. We will check and raise a bug ticket if needed. Thanks for reporting the issue.
Explore our Alfresco products with the links below. Use labels to filter content by product module.