Tags:
create new tag
view all tags

Table Sorting Messed Up

When a table contains spans in TML, sorting causes all kind of havoc... see test case below...

This behavior was noticed by RoyLeach.

Test case

Sort the table below by ID in reverse order and notice what happens. Many other sorts give "interesting" results as well. Sorting by Id in ascending order restores the table to normality...

Note that below I used TablePlugin to sort the second table, but this phenomenon occurs without the plugin also, as can be seen by manually sorting the first table...

Input table

ID TR ID Test Name Brief Desc Who Status Notes Bug #
1   Get down Everything that was good and wholesome is now gone forever BobDylan New    
2   Cant see ever Directly doing things doesnt have the desired result for our stuff sometimes BobDylan New    
3   This is really wierd It's cold in Alaska, especially in the winter without a coat BobDylan New    
3   Cant see sometimes Step 3.22.1: Selecting the thing from the whatamacallit results in not seeing the thingy we should. BobDylan New    
4 Step Up and be counted because being counted is a really good thing especially when everything you do counts so you should count and be counted daily. BobDylan New Existing  
5   Is that a train? It was something besides what it should be and that's bad BobDylan New    
6   Hearing test Today in the news, some plane crashed somewhere and someone was shot. These 2 occurances occured in different places, but it was a shame "None the less" said the people. KingLouis New    
7   too impulsive Okay, this is getting tiresome, not to mention monotonus. Did I spell that right? My spelling is kinda poor. TomOshane New    
8   everyone needs support I'm kinda greatful for spelll checkers because without them, everyone would know that I can't spell BobDylan New    
9 This is all I'm going to type, because I think it gets the idea accross of what I'm doing. Our real stuff has around 120 entries so I'm glad I'm not trying that! BobDylan New    

Same table, sorted on first column

IDSorted descending TR ID Test Name Brief Desc Who Status Notes Bug #
9   everyone needs support This is all I'm going to type, because I think it gets the idea accross of what I'm doing. Our real stuff has around 120 entries so I'm glad I'm not trying that! BobDylan New    
8   everyone needs support I'm kinda greatful for spelll checkers because without them, everyone would know that I can't spell BobDylan New    
7   too impulsive Okay, this is getting tiresome, not to mention monotonus. Did I spell that right? My spelling is kinda poor. TomOshane New    
6   Hearing test Today in the news, some plane crashed somewhere and someone was shot. These 2 occurances occured in different places, but it was a shame "None the less" said the people. KingLouis New    
5   Is that a train? It was something besides what it should be and that's bad BobDylan New    
4   Cant see sometimes Step Up and be counted because being counted is a really good thing especially when everything you do counts so you should count and be counted daily. BobDylan New Existing  
3   This is really wierd It's cold in Alaska, especially in the winter without a coat BobDylan New    
3   Cant see sometimes Step 3.22.1: Selecting the thing from the whatamacallit results in not seeing the thingy we should. BobDylan New    
2   Cant see ever Directly doing things doesnt have the desired result for our stuff sometimes BobDylan New    
1   Get down Everything that was good and wholesome is now gone forever BobDylan New    

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Linux, XP
Web server: Apache
Perl version: 5.8
Client OS: XP
Web Browser: IE

-- ThomasWeigert - 10 Aug 2005

Impact and Available Solutions

Follow up

Fix record

Discussion

How do you expect tables with combined cells to be sorted? Is there a defined outcome?

-- FranzJosefSilli - 10 Aug 2005

To be honest, I don't think anybody has thought about this. If I had to make up requirements, I would say that sort is definitely well-defined on columns which have no spans in it. In that case, the table should just be sorted. What you see above, though, is really strange. Sorting on the first column results in cells being shuffled between columns, even for rows that do not have spans in them.

How about the following for requirements:

  1. If a table has no spans, it sorts as currently.
  2. If a table has spans then
    1. If the table is sorted on a column which is not included in a span, the table sorts as expected
    2. Otherwise, the rows not part of a span are sorted in order, and
      1. if the span is a vertical span, the merged cells (containing the ^ ) immediately follow in the sort in the same order they are in the raw text
      2. if the span is a horizontal span, the merged cells (empty cells) are sorted as blanks.

Note that the example above only has vertical spans. Looking at the symptom it appears that the sorting takes out the complete cell if it contains a ^ .

-- ThomasWeigert - 11 Aug 2005

Note that horizontal spans work just as described in the requirement above:

IDSorted descending TR ID Test Name Brief Desc Who Status Notes Bug #
9 This is all I'm going to type, because I think it gets the idea accross of what I'm doing. Our real stuff has around 120 entries so I'm glad I'm not trying that! BobDylan New    
8   everyone needs support I'm kinda greatful for spelll checkers because without them, everyone would know that I can't spell BobDylan New    
7   too impulsive Okay, this is getting tiresome, not to mention monotonus. Did I spell that right? My spelling is kinda poor. TomOshane New    
6   Hearing test Today in the news, some plane crashed somewhere and someone was shot. These 2 occurances occured in different places, but it was a shame "None the less" said the people. KingLouis New    
5   Is that a train? It was something besides what it should be and that's bad BobDylan New    
4 Step Up and be counted because being counted is a really good thing especially when everything you do counts so you should count and be counted daily. BobDylan New Existing  
3 This is really wierd It's cold in Alaska, especially in the winter without a coat BobDylan New    
3   Cant see sometimes Step 3.22.1: Selecting the thing from the whatamacallit results in not seeing the thingy we should. BobDylan New    
2   Cant see ever Directly doing things doesnt have the desired result for our stuff sometimes BobDylan New    
1   Get down Everything that was good and wholesome is now gone forever BobDylan New    

-- ThomasWeigert - 11 Aug 2005

The Patch on http://twiki.org/cgi-bin/view/Plugins/TablePluginDev#PatchByLouisGranboulan by LouisGranboulan solves this problem and works well. Can we please get this patch into TablePlugin?

-- ThomasWeigert - 12 Aug 2005

Done in DevelopBranch

-- CrawfordCurrie - 21 Aug 2005

I applied the above mentioned patch from LouisGranboulan and the rendering of sorted tables has improved. It works now with rowspans, but not when colspan are used as in TextFormattingRules (multi span row in the L-C-R table). It does work here on twiki.org. So what am I missing?

-- DanielKabs - 01 Sep 2005

Not quite sure what you mean; does it work in DevelopBranch? Feel free to edit Bugs:Item243 and add a testcase, and re-open that report if it doesn't work.

-- CrawfordCurrie - 01 Sep 2005

Yes, sorting works in DevelopBranch but it does not work at home smile TWiki:Plugins/TablePluginDev#PatchByLouisGranboulan fails to work with colspan so your patch must be more "powerfull". Where can I find it?

-- DanielKabs - 16 Sep 2005

Edit | Attach | Watch | Print version | History: r13 < r12 < r11 < r10 < r9 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r13 - 2005-09-19 - DanielKabs
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.