• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7700 for generic doc work for TWiki-6.0.2. Use View topic Item7703 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item6406: Table sorting incorrect for negative numbers

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension TablePlugin Normal Closed   patch 5.0.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

According to the TablePlugin docs, data is only treated as numeric for sorting if it consists of digits plus an optional decimal point.

In particular, negative numbers are not sorted correctly:

%TABLE{sort="on" initsort="1"}%
| *number* |
| -1 |
| -10.1 |
| -9.99 |
| -2 |
| -2.0 |
| -20 |

produces:

numberSorted ascending
-20
-10.1
-9.99
-2
-2.0
-1

Is this behaviour intended?

-- TWiki:Main.BryanKitts - 12 Mar 2010

Changing lib/TWiki/Plugins/TablePlugin/Core.pm line 536 to this seems to fix it:

    elsif ( $text =~ /^\s*((-?[0-9]+)(\.([0-9]))?).*$/ ) {

-- TWiki:Main.BryanKitts - 12 Mar 2010

Thank you Bryan for reporting the issue and for providing a patch. This is now in trunk and 4.3 branch, as well as new release at TWiki:Plugins/TablePlugin.

-- TWiki:Main.PeterThoeny - 21 Mar 2010

ItemTemplate
Summary Table sorting incorrect for negative numbers
ReportedBy TWiki:Main.BryanKitts
Codebase 4.2.0
SVN Range

AppliesTo Extension
Component TablePlugin
Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:18395 TWikirev:18396
TargetRelease patch
ReleasedIn 5.0.0
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2010-05-31 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback