novo-elements
Version:
Bullhorn's NOVO Element Repository for Angular 2
34 lines (29 loc) • 877 B
text/typescript
// NG2
import { Directive, EventEmitter, Input, Output } from '@angular/core';
export class ThSortable {
config: any;
column: any;
onSortChange: EventEmitter<any> = new EventEmitter();
onToggleSort(event) {
if (event) {
event.preventDefault();
}
if (this.config && this.column && this.config.sorting !== false && this.column.sorting !== false) {
switch (this.column.sort) {
case 'asc':
this.column.sort = 'desc';
break;
default:
this.column.sort = 'asc';
break;
}
this.onSortChange.emit(this.column);
}
}
}