@@ -10,6 +10,7 @@ export interface IColumn {
10
10
columnId : string ;
11
11
cnt : number ;
12
12
visible : boolean ;
13
+ isSortedAsc : boolean ;
13
14
14
15
setV ( a : boolean ) : void ;
15
16
getV ( ) : boolean ;
@@ -21,6 +22,8 @@ export interface IColumn {
21
22
setPropertyName ( a : string ) : void ;
22
23
getPropertyName ( ) : string ;
23
24
25
+ getSortedAsc ( ) : boolean ;
26
+
24
27
print ( ) : void ;
25
28
26
29
addCnt1 ( ) : void ;
@@ -58,6 +61,7 @@ export default abstract class Column implements IColumn {
58
61
columnId : string ;
59
62
cnt : number ;
60
63
visible : boolean ;
64
+ isSortedAsc : boolean ;
61
65
62
66
constructor ( pname : string , app : App ) {
63
67
this . app = app ;
@@ -68,6 +72,7 @@ export default abstract class Column implements IColumn {
68
72
this . columnId = "" ;
69
73
this . cnt = 0 ;
70
74
this . visible = true ;
75
+ this . isSortedAsc = true ;
71
76
}
72
77
73
78
public extractCells ( rows : HTMLElement [ ] ) : HTMLElement [ ] {
@@ -79,7 +84,7 @@ export default abstract class Column implements IColumn {
79
84
} ) ;
80
85
return values ;
81
86
}
82
-
87
+
83
88
public applyV ( rows : HTMLElement [ ] ) {
84
89
let cells = this . extractCells ( rows ) ;
85
90
cells . forEach ( ( c ) => {
@@ -111,6 +116,10 @@ export default abstract class Column implements IColumn {
111
116
return this . cnt ;
112
117
}
113
118
119
+ public getSortedAsc ( ) : boolean {
120
+ return this . isSortedAsc ;
121
+ }
122
+
114
123
public setId ( a : string ) {
115
124
this . columnId = a ;
116
125
}
@@ -141,6 +150,7 @@ export default abstract class Column implements IColumn {
141
150
}
142
151
143
152
public setStrType ( a : string ) : void { }
153
+
144
154
public getStrType ( ) : string {
145
155
return "" ;
146
156
}
@@ -201,6 +211,7 @@ export default abstract class Column implements IColumn {
201
211
}
202
212
203
213
public sortRows ( rows : HTMLElement [ ] , asc : boolean ) : HTMLElement [ ] {
214
+ this . isSortedAsc = asc ;
204
215
return rows . sort ( ( a , b ) => {
205
216
const cellA = a . getElementsByTagName ( "td" ) [ this . columnIndex ] ?. textContent ?. trim ( ) . toLowerCase ( ) || "" ;
206
217
const cellB = b . getElementsByTagName ( "td" ) [ this . columnIndex ] ?. textContent ?. trim ( ) . toLowerCase ( ) || "" ;
0 commit comments