Tags:
create new tag
view all tags

Question

My problem: I have a page of "new people"" in the department. People are added as they join. Each person has a section and there is a table of contents, but the TOC is in order of joining.

I would like to view the TOC in alphabetical order. As long as I'm at it, I might as well look for a generalizable solution that can sort any bullet list.

I looked at SpreadSheetPlugin but the sort functions want table cells. No tables here.

I figured JavaScript could solve the problem.

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Javascript

-- VickiBrown - 06 Jul 2008

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

I did a web search for JavaScript that sorts lists and found a very promising script written by Bruno Bornsztein (blog.feedmarker.com). I ran into a few oddities - such as the fact that TWiki TOCs don't have a unique ID :-( but they do have a unique class :-) (providing, of course, that there is only one TOC on the page!)

I modified the JS to handle classes and got it working. You can see the results on my TWiki page.

The Javascript code is attached: list_sort.js

-- VickiBrown - 06 Jul 2008

Have a look at FilterPlugin. Its FORMATLIST might fit your needs.

-- MichaelDaum - 07 Jul 2008

Change status to:

Topic attachments
I Attachment History Action Size Date Who Comment
JavaScriptjs list_sort.js r1 manage 5.3 K 2008-07-06 - 17:13 UnknownUser JS functions to sort a TWIki list or TOC
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2008-07-07 - MichaelDaum
 
  • 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.