node-click and node-dblclick DOM events (#1863)

Extra DOM events with bubbling support for DocumentList:
- node-click
- node-dblclick
This commit is contained in:
Denys Vuika
2017-05-10 11:12:05 +01:00
committed by Eugenio Romano
parent 5c7d53230d
commit 07d898b2aa
9 changed files with 91 additions and 10 deletions

View File

@@ -206,6 +206,42 @@ _For a complete example source code please refer to
[DocumentList Demo](https://github.com/Alfresco/alfresco-ng2-components/tree/master/ng2-components/ng2-alfresco-documentlist/demo)
repository._
### DOM Events
Below are the DOM events the DocumentList component emits.
All of them are `bubbling`, meaning you can handle them in any component up the parent hierarchy, even if DocumentList is wrapped by another component(s).
| Name | Description |
| --- | --- |
| node-click | Raised when user clicks the node |
| node-dblclick | Raised when user double-clicks the node |
Every event is represented by a [CustomEvent](https://developer.mozilla.org/en/docs/Web/API/CustomEvent) instance, having at least the following properties as part of the `Event.detail` property value:
```ts
{
sender: DocumentListComponent,
node: MinimalNodeEntity
}
```
#### Handling DOM events
Here's a basic example on handling DOM events in the parent elements:
```html
<div (node-click)="onNodeClicked($event)"
(node-dblclick)="onNodeDblClicked($event)">
<div>
<alfresco-upload-drag-area ...>
<alfresco-document-list ...>
...
</alfresco-document-list>
</alfresco-upload-drag-area>
</div>
</div>
```
### Setting default folder
You can set current folder path by assigning a value for `currentFolderId` property.