[TW5] TOC problem with sorting - help needed

204 views
Skip to first unread message

Martin

unread,
Apr 11, 2015, 3:20:54 PM4/11/15
to tiddl...@googlegroups.com
I tried to use the toc macros according to the example found in tiddlywiki.com/#TableOfContentsMacro. I made use of the list field, where I added the tiddler titles in the order I want them to appear.

It worked fine at first. Then I changed some tiddler titles, and all of a sudden the tiddlers in the toc where sorted alphabetically. I am not able to get the toc back to sort according the list field. I saved the tw, refreshed the browser with Ctrl-F5 (Firefox), without success.

What am I doing wrong? Help is much appreciated.

Martin

Eric Shulman

unread,
Apr 11, 2015, 3:49:24 PM4/11/15
to tiddl...@googlegroups.com
By default, the items in the <<toc>> output are sorted alphabetically at each level.  As you know, you can override this order by using the "list" field.   Any titles entered there are shown in the <<toc>> output in the order specified.  Any other titles with the same tag are then shown alphabetically following the items from the list field.

In your case, you renamed some tiddlers... which are still tagged accordingly, so they still show up in the <<toc>> output.  However, the names entered into the "list" field are *not* automatically updated when you rename tiddlers, so the list field still has the old titles.  Because those tiddlers don't exist, they don't continue to show up in the <<toc>> output.  However, because the renamed tiddler titles are not in the list field, those tiddlers default to following the listed tiddlers, but in alphabetical order.  Which is just what you are observing.

solution: go back and edit the "list" fields to enter the updated tiddler titles in the desired order.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

"Inside TiddlyWiki: The Missing Manual"
Note: the IndieGogo funding campaign has ended,
but direct fundraising continues below...

YOUR DONATIONS ARE VERY IMPORTANT!
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:

Martin

unread,
Apr 13, 2015, 3:13:18 AM4/13/15
to tiddl...@googlegroups.com
Hello Eric,
thank you for your answer!
I did change the list field, but without effect. That is why I put the question here. If you could take a minute and have a look at this TW file
https://www.dropbox.com/s/ms341dmjpa2abvx/test-tw.html?dl=0

It just contains five tiddlers, one with the toc refering to the others. Somehow it seems that I mixed up something, but I can't find the cause.

Thank you in advance,
Martin

Eric Shulman

unread,
Apr 13, 2015, 4:12:06 AM4/13/15
to tiddl...@googlegroups.com
On Monday, April 13, 2015 at 12:13:18 AM UTC-7, Martin wrote:
Hello Eric,
thank you for your answer!
I did change the list field, but without effect. That is why I put the question here. If you could take a minute and have a look at this TW file
https://www.dropbox.com/s/ms341dmjpa2abvx/test-tw.html?dl=0

It just contains five tiddlers, one with the toc refering to the others. Somehow it seems that I mixed up something, but I can't find the cause.

You missed one vital step when you entered the list field... you didn't actually press the *add* button next to the input... so the tiddler [[inhaltsverzeichnis]] was not actually created, and no list field was defined.  Even so, your input into the *draft* tiddler was preserved when you saved the file.  So... all you need to do is edit [[inhaltsverzeichnis]], press "add", then "done".  The <<toc>> output will be automatically refreshed to the desired order.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

Martin

unread,
Apr 13, 2015, 6:10:40 AM4/13/15
to tiddl...@googlegroups.com
Uups, embarrasing... Thank you for the hint!

But nevertheless - I added the field "list" with the add button and saved the tiddler. But nothing changes. The TOC remains in the alphabetical order. Also, I deleted the list field and created a new one. It does not show any effect. I am really perplexed...

Eric Shulman

unread,
Apr 13, 2015, 6:36:20 AM4/13/15
to tiddl...@googlegroups.com
On Monday, April 13, 2015 at 3:10:40 AM UTC-7, Martin wrote:
Uups, embarrasing... Thank you for the hint!

But nevertheless - I added the field "list" with the add button and saved the tiddler. But nothing changes. The TOC remains in the alphabetical order. Also, I deleted the list field and created a new one. It does not show any effect. I am really perplexed...

Although you use [[Inhalt]] to display the <<toc>> macro, that is the wrong place to define the 'list' field.  Rather, the list field must be in the tiddler whose title is the same as the tag value used in the <<toc>> macro.  In other words, make a new tiddler named [[inhaltsverzeichnis]], and put the list *there*.  Then it will sort correctly.

-e

Martin

unread,
Apr 13, 2015, 6:47:42 AM4/13/15
to tiddl...@googlegroups.com
Aha, now I got it! (Some people are maybe a bit slow...)
So the title of the tiddler where I want to display the TOC must be same as the tag, then the sorting according to the list field works.

Thank you very much for your patience and your help!!
- martin

Eric Shulman

unread,
Apr 13, 2015, 6:54:30 AM4/13/15
to tiddl...@googlegroups.com
On Monday, April 13, 2015 at 3:47:42 AM UTC-7, Martin wrote:
Aha, now I got it! (Some people are maybe a bit slow...)
So the title of the tiddler where I want to display the TOC must be same as the tag, then the sorting according to the list field works.

The title of the tiddler that *displays* the TOC is not important.  What is important is the *tag value* you use in the <<toc>> macro.  You need to create a tiddler with the same title as the tag value in order to define the list field.  Of course, you CAN use the name of the tiddler that contains the <<toc>> macro, but then you would have to re-tag all your tiddlers with that value -- [[Inhalt]] -- instead of the current tag value of [[inhaltsverzeichnis]].

-e

Reply all
Reply to author
Forward
0 new messages