Item5568: ActionTracker enhancement: sortable columns

pencil
Priority: Enhancement
Current State: No Action Required
Released In:
Target Release: n/a
Applies To: Extension
Component: ActionTrackerPlugin
Branches:
Reported By: TWiki:Main.SeanCMorgan
Waiting For:
Last Change By: CrawfordCurrie

*Sortable columns*: "action tracker generates HTML tables, not TWiki tables, so the tables are not sortable by TablesPlugin." (TWiki:Main.CrawfordCurrie - 22 Feb 2007). Understood. But users, after they get used that feature, expect to see it everywhere.

I have a work-around that can be used in implementation. Obviously it would be better if a solution was native in the plug-in, because this requires extra effort and perhaps some knowledge of HTML. One option: there are "Javascript table sorters to avoid the round-trip to the server." (TWiki:Main.CrawfordCurrie - 26 Apr 2008).

Here's the work-around:

  1. For the column headers that you are using, add your own hyperlink to set a URL parameter with the desired sort order, e.g.,:
    * Set ACTIONTRACKERPLUGIN_TABLEHEADER = |<a style="color:white;" href=%SCRIPTURL%/view/%WEB%/%TOPIC%?action_sort=$due>Due date</a>|<a  style="color:white;" href=%SCRIPTURL%/view/%WEB%/%TOPIC%?action_sort=$text>Description</a>|<a style="color:white;" href=%SCRIPTURL%/view/%WEB%/%TOPIC%?action_sort=$uid>(edit)</a>|
  2. Detect that parameter and assign it to a TWikiVariable (usually the default order is $due, but here it's changed to $uid).
    * Set ACTIONTRACKERPLUGIN_SORTORDER = %IF{"defined action_sort" then="%URLPARAM{action_sort}%" else="$uid"}% 
  3. Use the sort order:
     %ACTIONSEARCH{state="open" topic="%TOPIC%.*" sort="%ACTIONTRACKERPLUGIN_SORTORDER%"}% 

Notes:
  • Step 1 should be done in the topic with the ACTIONSEARCH rather than defined globally. Otherwise all such column headers would show hyperlinks, but they only work if steps 2 and 3 are also done in the topic. In that case, Step 1 should be hidden in HTML comment tags.
  • Step 2 must be done in the topic with the ACTIONSEARCH. It should be hidden in HTML comment tags.
  • Steps 2 and 3 may be combined in one line.
  • If the topic contains more than one ACTIONSEARCH, as written, the same sort order is imposed on them all. You could use different parameters for each table if needed.

Aside: the work-around would be easier to roll-out if header formatting (Item4312) was implemented.

-- TWiki:Main/SeanCMorgan - 27 Apr 2008

P.S. Crawford, thanks for the suggestion to add enhancement requests here. I thought this web was just for ... you know ... Bugs! smile
Since I added support for format, header, footer etc parameters it's easy to generate a result that is sortable using the TablePlugin.

So no action required here.

-- CrawfordCurrie - 29 Jan 2009

ItemTemplate edit

Summary ActionTracker enhancement: sortable columns
ReportedBy TWiki:Main.SeanCMorgan
Codebase
SVN Range TWiki-5.0.0, Tue, 15 Apr 2008, build 16676
AppliesTo Extension
Component ActionTrackerPlugin
Priority Enhancement
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn
Topic revision: r3 - 29 Jan 2009, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy