mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
emit "sorting-changed" DOM event (DataTable) (#2916)
This commit is contained in:
committed by
Eugenio Romano
parent
2080d75d51
commit
0e51208333
@@ -369,6 +369,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck
|
||||
newDirection = current.direction === 'asc' ? 'desc' : 'asc';
|
||||
}
|
||||
this.data.setSorting(new DataSorting(column.key, newDirection));
|
||||
this.emitSortingChangedEvent(column.key, newDirection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,4 +520,15 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck
|
||||
});
|
||||
this.elementRef.nativeElement.dispatchEvent(domEvent);
|
||||
}
|
||||
|
||||
private emitSortingChangedEvent(key: string, direction: string) {
|
||||
const domEvent = new CustomEvent('sorting-changed', {
|
||||
detail: {
|
||||
key,
|
||||
direction
|
||||
},
|
||||
bubbles: true
|
||||
});
|
||||
this.elementRef.nativeElement.dispatchEvent(domEvent);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user