Added events to tie into beginning/ending of processing
This commit is contained in:
parent
7ee1eda2f0
commit
da9e3960e2
@ -64,12 +64,14 @@ Selector: `ng-datatable`
|
||||
| @Input() pageLength: number | Number of rows per page. Default 20 |
|
||||
| @Input() page: number | Current page |
|
||||
| @Input() paginate: boolean | Paginate rows or display all at once. Default true |
|
||||
| @Input() paginateCssClass: string | Class added to the paginator
|
||||
| @Input() paginateCssClass: string | Class added to the paginator |
|
||||
| @Input() selectionMode: null/'single'/'multi' | Allow selecting none, single or multiple rows at once |
|
||||
| @Input() showCheckbox: boolean | Show checkbox' for mass selecting |
|
||||
| @Input() tableLayout: 'auto'/'fixed' | CSS table layout. Defaults to 'auto' |
|
||||
| @Output() filterChanged: EventEmitter<(a, b) => 1/0/-1[]> | Applied filters |
|
||||
| @Output() finished: EventEmitter<any[]> | Emits when finished processing data |
|
||||
| @Output() pageChanged: EventEmitter<number> | New page |
|
||||
| @Output() processing: EventEmitter<any[]> | Emits when processing begins
|
||||
| @Output() selectionChanged: EventEmitter<any[]> | Selected rows |
|
||||
| pagedData: any[] | Array of rows on current page after sorting and filtering |
|
||||
| processedData: any[] | Array of remaining rows after sorting and filtering |
|
||||
|
@ -22,7 +22,9 @@ export class NgDatatableComponent implements OnInit {
|
||||
|
||||
// Outputs ===========================================================================================================
|
||||
@Output() filterChanged = new EventEmitter<any[]>(); // Output when filters change
|
||||
@Output() finished = new EventEmitter<any[]>(); // Fired after processing is finished
|
||||
@Output() pageChanged = new EventEmitter<number>(); // Output when page is changed
|
||||
@Output() processing = new EventEmitter<any[]>(); // Fires when grid begins to process
|
||||
@Output() selectionChanged = new EventEmitter<any[]>(); // Output when selected rows changes
|
||||
|
||||
// Properties ========================================================================================================
|
||||
@ -59,6 +61,7 @@ export class NgDatatableComponent implements OnInit {
|
||||
|
||||
// Helpers ===========================================================================================================
|
||||
private _process() {
|
||||
this.processing.emit(this.processedData);
|
||||
this.clearSelected();
|
||||
this.processedData = this._data;
|
||||
this.filters.forEach(f => this.processedData = this.processedData.filter(f));
|
||||
@ -83,6 +86,7 @@ export class NgDatatableComponent implements OnInit {
|
||||
} else {
|
||||
this.pagedData = this.processedData;
|
||||
}
|
||||
this.finished.emit(this.processedData);
|
||||
}
|
||||
|
||||
_convertWidth(width) {
|
||||
|
Loading…
Reference in New Issue
Block a user