chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.web-live.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tidy up GROUP BY a bit
[ypp-sc-tools.web-live.git]
/
yarrg
/
web
/
tabsort
diff --git
a/yarrg/web/tabsort
b/yarrg/web/tabsort
index e690ac8df740d2535ecc56425452e79ab4463305..ad25f86b9ab981d58ed2e740cd91cc9d7d6ba23e 100644
(file)
--- a/
yarrg/web/tabsort
+++ b/
yarrg/web/tabsort
@@
-38,6
+38,7
@@
<%args>
$table => 'ts_table'
$sortkeys => 'ts_sortkeys'
<%args>
$table => 'ts_table'
$sortkeys => 'ts_sortkeys'
+$throw => undef
$cols
</%args>
$cols
</%args>
@@
-60,6
+61,9
@@
function <% $sortfn %>(compar) {
var row= rows.item(rowix);
debug('process row '+rowix+' [[ '+row+' ]] id='+row.id)
if (!row.id) continue;
var row= rows.item(rowix);
debug('process row '+rowix+' [[ '+row+' ]] id='+row.id)
if (!row.id) continue;
+% if (defined $throw) {
+ if (row.id == '<% $throw %>') continue;
+% }
if (row.tagName != 'TR') continue;
newrows.push(row);
}
if (row.tagName != 'TR') continue;
newrows.push(row);
}
@@
-83,7
+87,12
@@
function <% $mapfn %>(rowelement) {
% if ($col->{SortKey}) {
return <% $col->{SortKey} %>;
% } else {
% if ($col->{SortKey}) {
return <% $col->{SortKey} %>;
% } else {
- return <% $sortkeys %>[<% $cix %>][rowid];
+% my $sk= "$sortkeys"."[$cix][rowid]";
+% if ($col->{MapFn}) {
+ return <% $col->{MapFn} %>(<% $sk %>);
+% } else {
+ return <% $sk %>;
+% }
% }
}
% }
}
@@
-116,8
+125,8
@@
function <% $tcomparefn %>(a,b) { return -<% $comparefn %>(a,b); }
function ts_onload__<% $table %>() {
var ts_add_heads= <% to_json_protecttags(\%add_heads) %>;
function ts_onload__<% $table %>() {
var ts_add_heads= <% to_json_protecttags(\%add_heads) %>;
- var
table= document.getElementById('<%
$table %>');
- var firstth=
table
.getElementsByTagName('th').item(0);
+ var
ctr= document.getElementById('<% defined($throw) ? $throw :
$table %>');
+ var firstth=
ctr
.getElementsByTagName('th').item(0);
var thlist= firstth.parentNode.getElementsByTagName('th');
debug('thlist='+thlist);
debug('thlist.item(2)=' + thlist.item(2));
var thlist= firstth.parentNode.getElementsByTagName('th');
debug('thlist='+thlist);
debug('thlist.item(2)=' + thlist.item(2));