Fossil SCM
Fix column sorting on ticket reports.
Commit
0e555dee63dab159b8fd5894fa1d0e208decb8a7
Parent
3f3eada10014f18…
1 file changed
+12
-14
+12
-14
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -955,11 +955,11 @@ | ||
| 955 | 955 | ** k Sort by the data-sortkey property |
| 956 | 956 | ** x This column is not sortable |
| 957 | 957 | ** |
| 958 | 958 | ** Capital letters mean sort in reverse order. |
| 959 | 959 | ** If there are fewer characters in zColumnTypes[] than their are columns, |
| 960 | -** the all extra columns assume type "t" (text). | |
| 960 | +** then all extra columns assume type "t" (text). | |
| 961 | 961 | ** |
| 962 | 962 | ** The third parameter is the column that was initially sorted (using 1-based |
| 963 | 963 | ** column numbers, like SQL). Make this value 0 if none of the columns are |
| 964 | 964 | ** initially sorted. Make the value negative if the column is initially sorted |
| 965 | 965 | ** in reverse order. |
| @@ -973,10 +973,12 @@ | ||
| 973 | 973 | ){ |
| 974 | 974 | @ <script> |
| 975 | 975 | @ function SortableTable(tableEl,columnTypes,initSort){ |
| 976 | 976 | @ this.tbody = tableEl.getElementsByTagName('tbody'); |
| 977 | 977 | @ this.columnTypes = columnTypes; |
| 978 | + @ var ncols = tableEl.rows[0].cells.length; | |
| 979 | + @ for(var i = columnTypes.length; i<=ncols; i++){this.columnTypes += 't';} | |
| 978 | 980 | @ this.sort = function (cell) { |
| 979 | 981 | @ var column = cell.cellIndex; |
| 980 | 982 | @ var sortFn; |
| 981 | 983 | @ switch( cell.sortType ){ |
| 982 | 984 | if( strchr(zColumnTypes,'n') ){ |
| @@ -983,13 +985,11 @@ | ||
| 983 | 985 | @ case "n": sortFn = this.sortNumeric; break; |
| 984 | 986 | } |
| 985 | 987 | if( strchr(zColumnTypes,'N') ){ |
| 986 | 988 | @ case "N": sortFn = this.sortReverseNumeric; break; |
| 987 | 989 | } |
| 988 | - if( strchr(zColumnTypes,'t') ){ | |
| 989 | - @ case "t": sortFn = this.sortText; break; | |
| 990 | - } | |
| 990 | + @ case "t": sortFn = this.sortText; break; | |
| 991 | 991 | if( strchr(zColumnTypes,'T') ){ |
| 992 | 992 | @ case "T": sortFn = this.sortReverseText; break; |
| 993 | 993 | } |
| 994 | 994 | if( strchr(zColumnTypes,'k') ){ |
| 995 | 995 | @ case "k": sortFn = this.sortKey; break; |
| @@ -1031,20 +1031,18 @@ | ||
| 1031 | 1031 | @ var clsName = hdrCell.className.replace(/\s*\bsort\s*\w+/, ''); |
| 1032 | 1032 | @ clsName += ' sort ' + sortType; |
| 1033 | 1033 | @ hdrCell.className = clsName; |
| 1034 | 1034 | @ } |
| 1035 | 1035 | @ } |
| 1036 | - if( strchr(zColumnTypes,'t') ){ | |
| 1037 | - @ this.sortText = function(a,b) { | |
| 1038 | - @ var i = thisObject.sortIndex; | |
| 1039 | - @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); | |
| 1040 | - @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); | |
| 1041 | - @ if(aa<bb) return -1; | |
| 1042 | - @ if(aa==bb) return a.rowIndex-b.rowIndex; | |
| 1043 | - @ return 1; | |
| 1044 | - @ } | |
| 1045 | - } | |
| 1036 | + @ this.sortText = function(a,b) { | |
| 1037 | + @ var i = thisObject.sortIndex; | |
| 1038 | + @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); | |
| 1039 | + @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); | |
| 1040 | + @ if(aa<bb) return -1; | |
| 1041 | + @ if(aa==bb) return a.rowIndex-b.rowIndex; | |
| 1042 | + @ return 1; | |
| 1043 | + @ } | |
| 1046 | 1044 | if( strchr(zColumnTypes,'T') ){ |
| 1047 | 1045 | @ this.sortReverseText = function(a,b) { |
| 1048 | 1046 | @ var i = thisObject.sortIndex; |
| 1049 | 1047 | @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1050 | 1048 | @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1051 | 1049 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -955,11 +955,11 @@ | |
| 955 | ** k Sort by the data-sortkey property |
| 956 | ** x This column is not sortable |
| 957 | ** |
| 958 | ** Capital letters mean sort in reverse order. |
| 959 | ** If there are fewer characters in zColumnTypes[] than their are columns, |
| 960 | ** the all extra columns assume type "t" (text). |
| 961 | ** |
| 962 | ** The third parameter is the column that was initially sorted (using 1-based |
| 963 | ** column numbers, like SQL). Make this value 0 if none of the columns are |
| 964 | ** initially sorted. Make the value negative if the column is initially sorted |
| 965 | ** in reverse order. |
| @@ -973,10 +973,12 @@ | |
| 973 | ){ |
| 974 | @ <script> |
| 975 | @ function SortableTable(tableEl,columnTypes,initSort){ |
| 976 | @ this.tbody = tableEl.getElementsByTagName('tbody'); |
| 977 | @ this.columnTypes = columnTypes; |
| 978 | @ this.sort = function (cell) { |
| 979 | @ var column = cell.cellIndex; |
| 980 | @ var sortFn; |
| 981 | @ switch( cell.sortType ){ |
| 982 | if( strchr(zColumnTypes,'n') ){ |
| @@ -983,13 +985,11 @@ | |
| 983 | @ case "n": sortFn = this.sortNumeric; break; |
| 984 | } |
| 985 | if( strchr(zColumnTypes,'N') ){ |
| 986 | @ case "N": sortFn = this.sortReverseNumeric; break; |
| 987 | } |
| 988 | if( strchr(zColumnTypes,'t') ){ |
| 989 | @ case "t": sortFn = this.sortText; break; |
| 990 | } |
| 991 | if( strchr(zColumnTypes,'T') ){ |
| 992 | @ case "T": sortFn = this.sortReverseText; break; |
| 993 | } |
| 994 | if( strchr(zColumnTypes,'k') ){ |
| 995 | @ case "k": sortFn = this.sortKey; break; |
| @@ -1031,20 +1031,18 @@ | |
| 1031 | @ var clsName = hdrCell.className.replace(/\s*\bsort\s*\w+/, ''); |
| 1032 | @ clsName += ' sort ' + sortType; |
| 1033 | @ hdrCell.className = clsName; |
| 1034 | @ } |
| 1035 | @ } |
| 1036 | if( strchr(zColumnTypes,'t') ){ |
| 1037 | @ this.sortText = function(a,b) { |
| 1038 | @ var i = thisObject.sortIndex; |
| 1039 | @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1040 | @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1041 | @ if(aa<bb) return -1; |
| 1042 | @ if(aa==bb) return a.rowIndex-b.rowIndex; |
| 1043 | @ return 1; |
| 1044 | @ } |
| 1045 | } |
| 1046 | if( strchr(zColumnTypes,'T') ){ |
| 1047 | @ this.sortReverseText = function(a,b) { |
| 1048 | @ var i = thisObject.sortIndex; |
| 1049 | @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1050 | @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1051 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -955,11 +955,11 @@ | |
| 955 | ** k Sort by the data-sortkey property |
| 956 | ** x This column is not sortable |
| 957 | ** |
| 958 | ** Capital letters mean sort in reverse order. |
| 959 | ** If there are fewer characters in zColumnTypes[] than their are columns, |
| 960 | ** then all extra columns assume type "t" (text). |
| 961 | ** |
| 962 | ** The third parameter is the column that was initially sorted (using 1-based |
| 963 | ** column numbers, like SQL). Make this value 0 if none of the columns are |
| 964 | ** initially sorted. Make the value negative if the column is initially sorted |
| 965 | ** in reverse order. |
| @@ -973,10 +973,12 @@ | |
| 973 | ){ |
| 974 | @ <script> |
| 975 | @ function SortableTable(tableEl,columnTypes,initSort){ |
| 976 | @ this.tbody = tableEl.getElementsByTagName('tbody'); |
| 977 | @ this.columnTypes = columnTypes; |
| 978 | @ var ncols = tableEl.rows[0].cells.length; |
| 979 | @ for(var i = columnTypes.length; i<=ncols; i++){this.columnTypes += 't';} |
| 980 | @ this.sort = function (cell) { |
| 981 | @ var column = cell.cellIndex; |
| 982 | @ var sortFn; |
| 983 | @ switch( cell.sortType ){ |
| 984 | if( strchr(zColumnTypes,'n') ){ |
| @@ -983,13 +985,11 @@ | |
| 985 | @ case "n": sortFn = this.sortNumeric; break; |
| 986 | } |
| 987 | if( strchr(zColumnTypes,'N') ){ |
| 988 | @ case "N": sortFn = this.sortReverseNumeric; break; |
| 989 | } |
| 990 | @ case "t": sortFn = this.sortText; break; |
| 991 | if( strchr(zColumnTypes,'T') ){ |
| 992 | @ case "T": sortFn = this.sortReverseText; break; |
| 993 | } |
| 994 | if( strchr(zColumnTypes,'k') ){ |
| 995 | @ case "k": sortFn = this.sortKey; break; |
| @@ -1031,20 +1031,18 @@ | |
| 1031 | @ var clsName = hdrCell.className.replace(/\s*\bsort\s*\w+/, ''); |
| 1032 | @ clsName += ' sort ' + sortType; |
| 1033 | @ hdrCell.className = clsName; |
| 1034 | @ } |
| 1035 | @ } |
| 1036 | @ this.sortText = function(a,b) { |
| 1037 | @ var i = thisObject.sortIndex; |
| 1038 | @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1039 | @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1040 | @ if(aa<bb) return -1; |
| 1041 | @ if(aa==bb) return a.rowIndex-b.rowIndex; |
| 1042 | @ return 1; |
| 1043 | @ } |
| 1044 | if( strchr(zColumnTypes,'T') ){ |
| 1045 | @ this.sortReverseText = function(a,b) { |
| 1046 | @ var i = thisObject.sortIndex; |
| 1047 | @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1048 | @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1049 |