+ private getSortedData(data: ANRNeighborCellRelation[]) {
+ if (!this.sort.active || this.sort.direction === '') {
+ return data;
+ }
+
+ return data.sort((a, b) => {
+ const isAsc = this.sort.direction === 'asc';
+ switch (this.sort.active) {
+ case 'cellIdentifierNrcgi': return compare(a.servingCellNrcgi, b.servingCellNrcgi, isAsc);
+ case 'neighborCellNrpci': return compare(a.neighborCellNrpci, b.neighborCellNrpci, isAsc);
+ case 'neighborCellNrcgi': return compare(a.neighborCellNrcgi, b.neighborCellNrcgi, isAsc);
+ case 'flagNoHo': return compare(a.flagNoHo, b.flagNoHo, isAsc);
+ case 'flagNoXn': return compare(a.flagNoXn, b.flagNoXn, isAsc);
+ case 'flagNoRemove': return compare(a.flagNoRemove, b.flagNoRemove, isAsc);
+ default: return 0;
+ }
+ });
+ }
+
+}
+
+function compare(a, b, isAsc) {
+ return (a < b ? -1 : 1) * (isAsc ? 1 : -1);