chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.main.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
where-vessels: make new comment section for vessel info reading etc.
[ypp-sc-tools.main.git]
/
yarrg
/
web
/
tabsort
diff --git
a/yarrg/web/tabsort
b/yarrg/web/tabsort
index 444bfb56b15f6e1b01e6e2ff74a29c1140209bb8..5031a988382acf63c15cf7f736cb710bce77c379 100644
(file)
--- a/
yarrg/web/tabsort
+++ b/
yarrg/web/tabsort
@@
-54,7
+54,9
@@
$cols
<&| script &>
<&| script &>
-% my $sortfn= "ts_sort__$table";
+% print $m->content();
+
+% my $sortfn= "ts_s_$table";
function <% $sortfn %>(compar) {
debug('sorting compar='+compar);
var table= document.getElementById('<% $table %>');
function <% $sortfn %>(compar) {
debug('sorting compar='+compar);
var table= document.getElementById('<% $table %>');
@@
-113,9
+115,9
@@
function <% $sortfn %>(compar) {
% my $thhtml= '';
% next if $col->{NoSort};
% my $thhtml= '';
% next if $col->{NoSort};
-% my $mapfn= "ts_
compar${cix}_map_
_$table";
-function <% $mapfn %>(r
owelement
) {
- var rowid = r
owelement
.id;
+% my $mapfn= "ts_
${cix}m
_$table";
+function <% $mapfn %>(r
e
) {
+ var rowid = r
e
.id;
% if ($col->{SortKey}) {
return <% $col->{SortKey} %>;
% } else {
% if ($col->{SortKey}) {
return <% $col->{SortKey} %>;
% } else {
@@
-128,24
+130,25
@@
function <% $mapfn %>(rowelement) {
% }
}
% }
}
-% my $comparefn= "ts_
compar${cix}_cmp0_
_$table";
+% my $comparefn= "ts_
${cix}c0
_$table";
function <% $comparefn %>(a,b) {
function <% $comparefn %>(a,b) {
- var a
_key
= <% $mapfn %>(a);
- var b
_key
= <% $mapfn %>(b);
+ var a
k
= <% $mapfn %>(a);
+ var b
k
= <% $mapfn %>(b);
% if ($col->{Numeric}) {
% if ($col->{Numeric}) {
- return a
_key - b_key
+ return a
k - bk
% } else {
% } else {
- if (a
_key < b_key
) return -1;
- if (a
_key > b_key
) return +1;
+ if (a
k < bk
) return -1;
+ if (a
k > bk
) return +1;
return 0;
% }
}
% foreach my $reverse (qw(1 0)) {
return 0;
% }
}
% foreach my $reverse (qw(1 0)) {
-% my $tcomparefn= "ts_
compar${cix}_cmp${reverse}_
_$table";
+% my $tcomparefn= "ts_
${cix}c${reverse}
_$table";
% if ($reverse) {
% next unless $col->{DoReverse};
function <% $tcomparefn %>(a,b) { return -<% $comparefn %>(a,b); }
% if ($reverse) {
% next unless $col->{DoReverse};
function <% $tcomparefn %>(a,b) { return -<% $comparefn %>(a,b); }
+
% }
% $thhtml .= "<a href=\"javascript:$sortfn($tcomparefn)\">".
% ($reverse ? '∨' : '∧'). '</a>';
% }
% $thhtml .= "<a href=\"javascript:$sortfn($tcomparefn)\">".
% ($reverse ? '∨' : '∧'). '</a>';
@@
-163,9
+166,12
@@
function ts_onload__<% $table %>() {
debug('thlist='+thlist);
debug('thlist.item(2)=' + thlist.item(2));
for (var cix in ts_add_heads) {
debug('thlist='+thlist);
debug('thlist.item(2)=' + thlist.item(2));
for (var cix in ts_add_heads) {
+ if (!ts_add_heads.hasOwnProperty(cix)) continue;
var ah = ts_add_heads[cix];
debug('appending to cix='+cix+' ah='+ah);
thlist.item(cix).innerHTML += ah;
}
}
var ah = ts_add_heads[cix];
debug('appending to cix='+cix+' ah='+ah);
thlist.item(cix).innerHTML += ah;
}
}
+
+register_onload(ts_onload__<% $table %>);
</&>
</&>