mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
#478 Custom event emitter for data loaded event
This commit is contained in:
parent
6873fc01bc
commit
820e200379
@ -50,5 +50,15 @@ export interface PaginationProvider {
|
|||||||
/**
|
/**
|
||||||
* An event that is emitted every time data is loaded.
|
* 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { Subject } from 'rxjs/Rx';
|
|
||||||
import { ObjectUtils } from 'ng2-alfresco-core';
|
import { ObjectUtils } from 'ng2-alfresco-core';
|
||||||
import {
|
import {
|
||||||
PaginationProvider,
|
PaginationProvider, DataLoadedEventEmitter,
|
||||||
DataTableAdapter,
|
DataTableAdapter,
|
||||||
DataRow, DataColumn, DataSorting
|
DataRow, DataColumn, DataSorting
|
||||||
} from 'ng2-alfresco-datatable';
|
} from 'ng2-alfresco-datatable';
|
||||||
@ -52,12 +51,12 @@ export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvid
|
|||||||
private _maxItems: number = this.DEFAULT_PAGE_SIZE;
|
private _maxItems: number = this.DEFAULT_PAGE_SIZE;
|
||||||
|
|
||||||
thumbnails: boolean = false;
|
thumbnails: boolean = false;
|
||||||
dataLoaded: Subject<any>;
|
dataLoaded: DataLoadedEventEmitter;
|
||||||
|
|
||||||
constructor(private documentListService: DocumentListService,
|
constructor(private documentListService: DocumentListService,
|
||||||
private basePath: string,
|
private basePath: string,
|
||||||
schema: DataColumn[]) {
|
schema: DataColumn[]) {
|
||||||
this.dataLoaded = new Subject<any>();
|
this.dataLoaded = new DataLoadedEventEmitter();
|
||||||
this.rows = [];
|
this.rows = [];
|
||||||
this.columns = schema || [];
|
this.columns = schema || [];
|
||||||
this.resetPagination();
|
this.resetPagination();
|
||||||
@ -206,7 +205,7 @@ export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvid
|
|||||||
})
|
})
|
||||||
.subscribe(val => {
|
.subscribe(val => {
|
||||||
this.loadPage(<NodePaging>val);
|
this.loadPage(<NodePaging>val);
|
||||||
this.dataLoaded.next();
|
this.dataLoaded.emit(null);
|
||||||
},
|
},
|
||||||
error => console.error(error));
|
error => console.error(error));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user