Bug: Sorting tables that use rowspan fails
Since sorting only reorders the rows in the table, rowspan appear in wrong places.
A solution is to repeat the content of the spanned row when sorting is done.
Here is a patch that implements this solution.
--- TablePlugin.pm.orig Sun Mar 7 15:35:20 2004
+++ TablePlugin.pm Fri Jun 11 13:02:27 2004
@@ -488,6 +488,20 @@
@trailer = splice( @curTable, -$footerRows );
}
+ # Handle multi-row labels
+ for my $row (0..$#curTable) {
+ for my $col (0..$#{$curTable[$row]}) {
+ $curTable[$row][$col][1] =~ s/ rowspan="[^"]+"//;
+ $curTable[$row][$col] =
+ [ $curTable[$row-1][$col][0],
+ $curTable[$row][$col][1],
+ "td",
+ $curTable[$row][$col][3],
+ $curTable[$row][$col][4] ]
+ if $curTable[$row][$col][2] eq "X";
+ }
+ }
+
$stype = colType( $sortCol );
&TWiki::Func::writeDebug( "- TWiki::Plugins::TablePlugin sorting col $sortCol as $fields[$stype]" ) if $debug;
if( $stype ) {
Test case
Environment
The bug is in
TablePlugin $VERSION = '1.012'; # 01 Dec 2003
It is independent of the TWiki version or the environment.
--
LouisGranboulan - 11 Jun 2004
Follow up
Thanks Louis. I have seen that you posted the bug and fix also in the
TablePluginDev topic (which is where it belongs). I set this bug report to N/A ("rejected") since the Codev bug tracking is just used for the core code and doc.
Fix record