mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
Simple 'item click' event
This commit is contained in:
parent
088f365355
commit
f1b6d02a93
@ -1,4 +1,4 @@
|
|||||||
import {Component, OnInit, Input} from "angular2/core";
|
import {Component, OnInit, Input, Output, EventEmitter} from "angular2/core";
|
||||||
import {AlfrescoService} from "./alfresco.service";
|
import {AlfrescoService} from "./alfresco.service";
|
||||||
import {FolderEntity} from "./core/entities/folder.entity";
|
import {FolderEntity} from "./core/entities/folder.entity";
|
||||||
import {DocumentEntity} from "./core/entities/document.entity";
|
import {DocumentEntity} from "./core/entities/document.entity";
|
||||||
@ -79,6 +79,8 @@ export class DocumentList implements OnInit {
|
|||||||
// example: <alfresco-document-list #list [downloads]="false"></alfresco-document-list>
|
// example: <alfresco-document-list #list [downloads]="false"></alfresco-document-list>
|
||||||
@Input() downloads: boolean = true;
|
@Input() downloads: boolean = true;
|
||||||
|
|
||||||
|
@Output() itemClick: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
rootFolder = {
|
rootFolder = {
|
||||||
name: 'Document Library',
|
name: 'Document Library',
|
||||||
path: 'swsdp/documentLibrary'
|
path: 'swsdp/documentLibrary'
|
||||||
@ -137,6 +139,10 @@ export class DocumentList implements OnInit {
|
|||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.itemClick.emit({
|
||||||
|
value: item
|
||||||
|
});
|
||||||
|
|
||||||
if (this.navigate && item) {
|
if (this.navigate && item) {
|
||||||
if (item.isFolder) {
|
if (item.isFolder) {
|
||||||
var path = this.getItemPath(item);
|
var path = this.getItemPath(item);
|
||||||
|
@ -13,13 +13,20 @@ import {DocumentList} from "./document-list.component";
|
|||||||
<li><label><input type="checkbox" [(ngModel)]="navigation"> Navigation</label></li>
|
<li><label><input type="checkbox" [(ngModel)]="navigation"> Navigation</label></li>
|
||||||
<li><label><input type="checkbox" [(ngModel)]="downloads"> Downloads</label></li>
|
<li><label><input type="checkbox" [(ngModel)]="downloads"> Downloads</label></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<hr>
|
||||||
|
<ul class="list-unstyled" style="font-size: 10px">
|
||||||
|
<li *ngFor="#event of events">
|
||||||
|
<strong>{{event.name}}</strong>: {{event.value.displayName}}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<alfresco-document-list #list
|
<alfresco-document-list #list
|
||||||
[thumbnails]="thumbnails"
|
[thumbnails]="thumbnails"
|
||||||
[breadcrumb]="breadcrumb"
|
[breadcrumb]="breadcrumb"
|
||||||
[navigate]="navigation"
|
[navigate]="navigation"
|
||||||
[downloads]="downloads">
|
[downloads]="downloads"
|
||||||
|
(itemClick)="onItemClick($event)">
|
||||||
</alfresco-document-list>
|
</alfresco-document-list>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -32,4 +39,14 @@ export class HomeView {
|
|||||||
breadcrumb: boolean = false;
|
breadcrumb: boolean = false;
|
||||||
navigation: boolean = true;
|
navigation: boolean = true;
|
||||||
downloads: boolean = true;
|
downloads: boolean = true;
|
||||||
|
|
||||||
|
events: any[] = [];
|
||||||
|
|
||||||
|
onItemClick($event) {
|
||||||
|
console.log($event.value);
|
||||||
|
this.events.push({
|
||||||
|
name: 'Item Clicked',
|
||||||
|
value: $event.value
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user