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 {
|
||||
const isSameProperty = this.sortProperty === property;
|
||||
this.sortProperty = property;
|
||||
this.sortDirection = isSameProperty ? (this.sortDirection === 'asc' ? 'desc' : 'asc') : this.sortDirection;
|
||||
if (this.sortProperty === property) {
|
||||
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
|
||||
} else {
|
||||
this.sortProperty = property;
|
||||
this.sortDirection = 'desc';
|
||||
}
|
||||
|
||||
// Persist sort settings
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue