Skip to content

Commit 967146a

Browse files
committed
update for sorting
1 parent 9eea998 commit 967146a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/app/app.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export class AppComponent {
3535
value: 'ts',
3636
text: 'Posted Date'
3737
}];
38+
sortedColumnKey: string;
3839
sortedColumn: string;
3940
sortedAsc = 'asc';
4041
sortedDesc = 'desc';
@@ -114,13 +115,14 @@ export class AppComponent {
114115
}
115116

116117
sort(column: any) {
117-
if (this.sortedColumn === column.key) {
118+
if (this.sortedColumnKey === column.key) {
118119
this.sortedOrder = this.sortedOrder === this.sortedAsc ? this.sortedDesc : this.sortedAsc;
119120
} else {
120121
this.sortedOrder = this.sortedAsc;
121122
}
122-
this.sortedColumn = column.key;
123-
this.getList(1, this.pageSize, column.value, this.sortedOrder);
123+
this.sortedColumnKey = column.key;
124+
this.sortedColumn = column.value;
125+
this.getList(1, this.pageSize, this.sortedColumn, this.sortedOrder);
124126
}
125127

126128
}

0 commit comments

Comments
 (0)