Fossil SCM

make quickfilter work correctly with multirow reports

jkosche 2025-05-24 16:25 quickfilter
Commit a42c48797cf44588fa53a6c983a8921eb0f9df0d6b31f12225d3aa122fee054a
2 files changed +15 -2 +2 -1
--- src/quickfilter.js
+++ src/quickfilter.js
@@ -16,20 +16,26 @@
1616
});
1717
1818
quickfilter.addEventListener('input', function(){
1919
const filterrows = document.querySelectorAll('.filterable tbody tr');
2020
const filter = quickfilter.value.toLowerCase().trim();
21
+ let group = null;
22
+ let groupmatched = false;
2123
for(row of filterrows){
2224
const orig = row.innerHTML;
2325
const cleaned = orig.replaceAll("<mark>", "").replaceAll("</mark>", "");
2426
if(filter===''){
2527
row.innerHTML = cleaned;
2628
row.style.display = 'table-row';
2729
continue;
30
+ }
31
+ if (row.classList.contains("separator")){
32
+ group = [];
33
+ groupmatched = false;
2834
}
2935
let ind = cleaned.toLowerCase().lastIndexOf(filter);
30
- if(ind<0){
36
+ if(ind<0 && !groupmatched){
3137
row.innerHTML = cleaned;
3238
row.style.display = 'none';
3339
}
3440
let marked = cleaned;
3541
do{
@@ -39,9 +45,16 @@
3945
marked.substring(ind, ind+filter.length)+'</mark>'+
4046
marked.substring(ind+filter.length);
4147
}
4248
ind = cleaned.toLowerCase().lastIndexOf(filter,ind-1);
4349
}while(ind>=0);
44
- row.style.display = (marked===cleaned) ? 'none' : 'table-row';
50
+ row.style.display =
51
+ (marked===cleaned && !groupmatched) ? 'none' : 'table-row';
4552
row.innerHTML = marked;
53
+ if (marked!=cleaned && group){
54
+ if (!groupmatched)
55
+ for (grouprow of group) grouprow.style.display = 'table-row';
56
+ groupmatched = true;
57
+ }
58
+ if (group) group.push(row);
4659
};
4760
});
4861
--- src/quickfilter.js
+++ src/quickfilter.js
@@ -16,20 +16,26 @@
16 });
17
18 quickfilter.addEventListener('input', function(){
19 const filterrows = document.querySelectorAll('.filterable tbody tr');
20 const filter = quickfilter.value.toLowerCase().trim();
 
 
21 for(row of filterrows){
22 const orig = row.innerHTML;
23 const cleaned = orig.replaceAll("<mark>", "").replaceAll("</mark>", "");
24 if(filter===''){
25 row.innerHTML = cleaned;
26 row.style.display = 'table-row';
27 continue;
 
 
 
 
28 }
29 let ind = cleaned.toLowerCase().lastIndexOf(filter);
30 if(ind<0){
31 row.innerHTML = cleaned;
32 row.style.display = 'none';
33 }
34 let marked = cleaned;
35 do{
@@ -39,9 +45,16 @@
39 marked.substring(ind, ind+filter.length)+'</mark>'+
40 marked.substring(ind+filter.length);
41 }
42 ind = cleaned.toLowerCase().lastIndexOf(filter,ind-1);
43 }while(ind>=0);
44 row.style.display = (marked===cleaned) ? 'none' : 'table-row';
 
45 row.innerHTML = marked;
 
 
 
 
 
 
46 };
47 });
48
--- src/quickfilter.js
+++ src/quickfilter.js
@@ -16,20 +16,26 @@
16 });
17
18 quickfilter.addEventListener('input', function(){
19 const filterrows = document.querySelectorAll('.filterable tbody tr');
20 const filter = quickfilter.value.toLowerCase().trim();
21 let group = null;
22 let groupmatched = false;
23 for(row of filterrows){
24 const orig = row.innerHTML;
25 const cleaned = orig.replaceAll("<mark>", "").replaceAll("</mark>", "");
26 if(filter===''){
27 row.innerHTML = cleaned;
28 row.style.display = 'table-row';
29 continue;
30 }
31 if (row.classList.contains("separator")){
32 group = [];
33 groupmatched = false;
34 }
35 let ind = cleaned.toLowerCase().lastIndexOf(filter);
36 if(ind<0 && !groupmatched){
37 row.innerHTML = cleaned;
38 row.style.display = 'none';
39 }
40 let marked = cleaned;
41 do{
@@ -39,9 +45,16 @@
45 marked.substring(ind, ind+filter.length)+'</mark>'+
46 marked.substring(ind+filter.length);
47 }
48 ind = cleaned.toLowerCase().lastIndexOf(filter,ind-1);
49 }while(ind>=0);
50 row.style.display =
51 (marked===cleaned && !groupmatched) ? 'none' : 'table-row';
52 row.innerHTML = marked;
53 if (marked!=cleaned && group){
54 if (!groupmatched)
55 for (grouprow of group) grouprow.style.display = 'table-row';
56 groupmatched = true;
57 }
58 if (group) group.push(row);
59 };
60 });
61
+2 -1
--- src/report.c
+++ src/report.c
@@ -903,11 +903,12 @@
903903
904904
/* Output the separator above each entry in a table which has multiple lines
905905
** per database entry.
906906
*/
907907
if( pState->iNewRow>=0 ){
908
- @ <tr><td colspan="%d(pState->nCol)" style="padding:0px">
908
+ @ <tr class="separator"><td colspan="%d(pState->nCol)"
909
+ @ style="padding:0px">
909910
@ <hr style="margin:0px"></td></tr>
910911
}
911912
912913
/* Output the data for this entry from the database
913914
*/
914915
--- src/report.c
+++ src/report.c
@@ -903,11 +903,12 @@
903
904 /* Output the separator above each entry in a table which has multiple lines
905 ** per database entry.
906 */
907 if( pState->iNewRow>=0 ){
908 @ <tr><td colspan="%d(pState->nCol)" style="padding:0px">
 
909 @ <hr style="margin:0px"></td></tr>
910 }
911
912 /* Output the data for this entry from the database
913 */
914
--- src/report.c
+++ src/report.c
@@ -903,11 +903,12 @@
903
904 /* Output the separator above each entry in a table which has multiple lines
905 ** per database entry.
906 */
907 if( pState->iNewRow>=0 ){
908 @ <tr class="separator"><td colspan="%d(pState->nCol)"
909 @ style="padding:0px">
910 @ <hr style="margin:0px"></td></tr>
911 }
912
913 /* Output the data for this entry from the database
914 */
915

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button