File tree Expand file tree Collapse file tree 1 file changed +1
-14
lines changed Expand file tree Collapse file tree 1 file changed +1
-14
lines changed Original file line number Diff line number Diff line change @@ -23,17 +23,4 @@ function myFunction() {
23
23
tr [ i ] . style . display = "none" ;
24
24
}
25
25
}
26
- }
27
- const getCellValue = ( tr , idx ) => tr . children [ idx ] . innerText || tr . children [ idx ] . textContent ;
28
-
29
- const comparer = ( idx , asc ) => ( a , b ) => ( ( v1 , v2 ) =>
30
- v1 !== '' && v2 !== '' && ! isNaN ( v1 ) && ! isNaN ( v2 ) ? v1 - v2 : v1 . toString ( ) . localeCompare ( v2 )
31
- ) ( getCellValue ( asc ? a : b , idx ) , getCellValue ( asc ? b : a , idx ) ) ;
32
-
33
- // do the work...
34
- document . querySelectorAll ( 'th' ) . forEach ( th => th . addEventListener ( 'click' , ( ( ) => {
35
- const table = th . closest ( 'table' ) ;
36
- Array . from ( table . querySelectorAll ( 'tr:nth-child(n+2)' ) )
37
- . sort ( comparer ( Array . from ( th . parentNode . children ) . indexOf ( th ) , this . asc = ! this . asc ) )
38
- . forEach ( tr => table . appendChild ( tr ) ) ;
39
- } ) ) ) ;
26
+ }
You can’t perform that action at this time.
0 commit comments