Tags:
create new tag
, view all tags

Question

This bug should be fixed, if TablePlugin.pm is replaced with the attached version.

Initsort argument was obtained only from first %TABLE(initsort)% on topic. Other tables with initsorts were sorted with args of first one.

Tested:

  • TWiki version: 20011201
  • Web server: Apache of course (1.3.19)
  • Server OS: SuSe Linux 2.4.4
  • Perl v5.6.0
  • Web browser: IE5
  • Client OS: Windows NT

-- TWikiGuest - 02 Nov 2002

Wasn't sure if this should go into TablePluginDev or here. (Here! Plugins web is already too busy!)

I had the TablePlugin installed on our TWiki site and was doing fine. I could have multiple tables on a single page all sorting according to different criteria and different directions. I just downloaded the newest (05-Jun) version of the Plugin and have lost the ability to specify the sorting on multiple tables within the same page.

In my Apache error log I have a lot of:

[Wed Jun 19 13:02:12 2002] view: Use of uninitialized value in string eq at ../lib/TWiki/Plugins/TablePlugin.pm line 302.
[Wed Jun 19 13:02:12 2002] view: Use of uninitialized value in string eq at ../lib/TWiki/Plugins/TablePlugin.pm line 302.
[Wed Jun 19 13:16:48 2002] view: Use of uninitialized value in subtraction (-) at ../lib/TWiki/Plugins/TablePlugin.pm line 297.

  • TWiki version: 20011201
  • Web server: Apache of course (1.3.24)
  • Server OS: Solaris 2.8
  • Web browser: Netscape 6.22
  • Client OS: Solaris 2.8

-- MicahHoffman - 19 Jun 2002

Answer

Not Preceeded by TABLE

Title Author Level Reviewer Ref
Effective Java Programming Language Guide Bloch, J. Int. x  
Core J2EE Patterns: Best Practices and Design Strategies Crupi, et. al Advanced x  

Preceeded by TABLE{ initsort="3" } :

Table 2 AAA BBBSorted ascending
7 6 1
2 16 5
6 4 33
1 10 99

Not Preceeded by TABLE

Title Author Level Reviewer Ref
Effective Java Programming Language Guide Bloch, J. Int. y  
Core J2EE Patterns: Best Practices and Design Strategies Crupi, et. al Advanced x  

Preceeded by TABLE{ initsort="2" } :

Table 1 AAASorted ascending BBB
yyy aaa uuu
aaa bbb aaa
uuu eee lll
www ggg iii

Preceeded by TABLE{ initsort="1" } :

Table 3Sorted ascending AAA BBB
i t s
i r i
k e h
t p s
w e u

note: Only one "column-header click" sort can be active in any topic. Any initsort setting for the table is superseded by clicking a column header to sort.

The fix should be attached; incorporates changes in TablePlugin.pm function emitTable().

-- TWikiGuest - 01 Nov 2002

To fix the multiple-table sort problem, make this simple change to the file TablePlugin/Core.pm

# NOTE: Modified by Raymond Lutz to allow multiple tables to be sorted on one page.
# On second pass, $sortCol is defined from the last table, and it then undefines the
# sort flag. This is simply commented out, and parameters set according to the current
# value of $initSort.

#    if ( defined( $sortCol ) ) {         # COMMENT OUT
#        undef $initSort;                   # COMMENT OUT
#    } elsif( defined( $initSort ) ) {   # COMMENT OUT
     if( defined( $initSort ) ) {           # MODIFY elseif TO if
        $sortCol = $initSort - 1;
        $up = $initDirection;
        $direction = $up ? 0 : 1;
        $requestedTable = $tableCount;
    }

-- RaymondLutz - 14 Dec 2006

This does set the initial sorting state for multiple tables. But after that it is no longer possible to sort on a different column; the initsort value is kept.

In the TestCases web (in SVN) is a page with TablePlugin tests. It is really helpful to see what effect a code change has on all table variations.

-- ArthurClemens - 14 Dec 2006

 
Topic attachments
I Attachment Action Size Date Who Comment
Perl source code filepm TablePlugin.pm manage 16.6 K 2002-11-04 - 16:44 TWikiGuest optimize for initsort
Topic revision: r8 - 2006-12-14 - ArthurClemens
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by PerlIdeas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.