Fix sorting logic to default to descending order for new properties
This commit is contained in:
parent
3eda321d64
commit
6dedb621d1
1 changed files with 6 additions and 3 deletions
|
|
@ -96,9 +96,12 @@ export class TorrentTableComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public sort(property: string): void {
|
public sort(property: string): void {
|
||||||
const isSameProperty = this.sortProperty === property;
|
if (this.sortProperty === property) {
|
||||||
this.sortProperty = property;
|
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
|
||||||
this.sortDirection = isSameProperty ? (this.sortDirection === 'asc' ? 'desc' : 'asc') : this.sortDirection;
|
} else {
|
||||||
|
this.sortProperty = property;
|
||||||
|
this.sortDirection = 'desc';
|
||||||
|
}
|
||||||
|
|
||||||
// Persist sort settings
|
// Persist sort settings
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue