in ui/src/app/data-explorer-shared/components/charts/table/table-widget.component.ts [108:138]
sortData(event) {
if (event.direction === 'asc') {
this.dataSource.data = this.dataSource.data.sort((a, b) =>
a[event.active] > b[event.active]
? 1
: b[event.active] > a[event.active]
? -1
: 0,
);
}
if (event.direction === 'desc') {
this.dataSource.data = this.dataSource.data.sort((a, b) =>
a[event.active] > b[event.active]
? -1
: b[event.active] > a[event.active]
? 1
: 0,
);
}
if (event.direction === '') {
this.dataSource.data = this.dataSource.data.sort((a, b) =>
a['timestamp'] > b['timestamp']
? 1
: b['timestamp'] > a['timestamp']
? -1
: 0,
);
}
}