chiark / gitweb /
Redo aggregation
[ypp-sc-tools.db-live.git] / yarrg / web / tabsort
index 00f361406c39241c0b5767b8b5efa5aedf51faca..444bfb56b15f6e1b01e6e2ff74a29c1140209bb8 100644 (file)
@@ -40,6 +40,7 @@ $table => 'ts_table'
 $sortkeys => 'ts_sortkeys'
 $throw => undef
 $tbrow => undef
+$rowclass => undef
 $cols
 </%args>
 
@@ -90,6 +91,14 @@ function <% $sortfn %>(compar) {
     debug('final row '+rowix+' [[ '+row+' ]]');
   }
   newrows.sort(compar);
+%      if (defined $rowclass) {
+  for (var rowix=0; rowix < newrows.length; rowix++) {
+    var row= newrows[rowix];
+    var classname= '<% $rowclass %>'+(rowix % 2);
+    debug('fix row '+rowix+' class '+classname);
+    row.className= classname;
+  }
+%      }
   newrows= newrows.concat(finalrows);
   for (var rowix=0; rowix < newrows.length; rowix++) {
     var row= newrows[rowix];
@@ -132,7 +141,7 @@ function <% $comparefn %>(a,b) {
 %      }
 }
 
-%      foreach my $reverse (qw(0 1)) {
+%      foreach my $reverse (qw(1 0)) {
 %              my $tcomparefn= "ts_compar${cix}_cmp${reverse}__$table";
 %              if ($reverse) {
 %                      next unless $col->{DoReverse};