#478 Custom event emitter for data loaded event

This commit is contained in:
Denys Vuika 2016-10-28 15:03:53 +01:00
parent 6873fc01bc
commit 820e200379
2 changed files with 15 additions and 6 deletions

View File

@ -50,5 +50,15 @@ export interface PaginationProvider {
/**
* An event that is emitted every time data is loaded.
*/
dataLoaded: Subject<any>;
dataLoaded: DataLoadedEventEmitter;
}
export class DataLoadedEventEmitter extends Subject<any> {
constructor() {
super();
}
emit(value) {
super.next(value);
}
}

View File

@ -16,10 +16,9 @@
*/
import { DatePipe } from '@angular/common';
import { Subject } from 'rxjs/Rx';
import { ObjectUtils } from 'ng2-alfresco-core';
import {
PaginationProvider,
PaginationProvider, DataLoadedEventEmitter,
DataTableAdapter,
DataRow, DataColumn, DataSorting
} from 'ng2-alfresco-datatable';
@ -52,12 +51,12 @@ export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvid
private _maxItems: number = this.DEFAULT_PAGE_SIZE;
thumbnails: boolean = false;
dataLoaded: Subject<any>;
dataLoaded: DataLoadedEventEmitter;
constructor(private documentListService: DocumentListService,
private basePath: string,
schema: DataColumn[]) {
this.dataLoaded = new Subject<any>();
this.dataLoaded = new DataLoadedEventEmitter();
this.rows = [];
this.columns = schema || [];
this.resetPagination();
@ -206,7 +205,7 @@ export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvid
})
.subscribe(val => {
this.loadPage(<NodePaging>val);
this.dataLoaded.next();
this.dataLoaded.emit(null);
},
error => console.error(error));
}