+% while ($row= $sth->fetchrow_arrayref) {
+% if (!$rowix) {
+<table id="<% $bs %>_table" rules=groups>
+<colgroup span=2>
+<colgroup span=3>
+<colgroup span=1>
+<tr>
+<th>Archipelago
+<th>Island
+<th>Stall or Shoppe
+<th>Price
+<th>Quantity
+<th>Data age
+</tr>
+% }
+% my $rowid= ${bs}.$row->[6];
+% my $tscellid= "c$rowid";
+% my $age= $now - $row->[5];
+% $da_ages{$rowid}= $age;
+% $row->[5]=
+<tr id=<% $rowid %> class="<% 'datarow'.($rowix & 1) %>" >
+% foreach my $ci (0..4) {
+% my $val= $row->[$ci];
+% $ts_sortkeys{$ci}{$rowid}= $val;
+<td <% $ci >= 3 ? 'align=right' : '' %> ><% $val |h %>
+% }
+<td id="<% $tscellid %>" align=right><% prettyprint_age($age) %>
+</tr>
+% $rowix++;
+% }
+% if ($rowix) {
+</table>
+
+<&| tabsort, table => "${bs}_table", rowclass => 'datarow', cols => [
+ {}, {}, {},
+ { Numeric => 1, DoReverse => 1 },
+ { Numeric => 1, DoReverse => 1 },
+ { Numeric => 1, DoReverse => 1, SortKey => "${bs}_ages[rowid]" }],
+ sortkeys => "${bs}_sortkeys"
+ &>
+ <%$bs%>_sortkeys= <% to_json_protecttags(\%ts_sortkeys) %>;
+ <%$bs%>_ages= <% to_json_protecttags(\%da_ages) %>;
+</&tabsort>
+% } else {
+No offers.
+% }
+