Sort List

231 views
Skip to first unread message

Max Dbosyo

unread,
Oct 26, 2016, 4:15:32 AM10/26/16
to TiddlyWiki
hi,

quick question

i  am a absolute beginner when it comes to coding but i trying to teach myself right now, i find tiddlywiki very user-friendly and i accomplished a lot of thing with it what i thought i could not do.
So i hope u guys can help me out, with one thing what i dont manage to get working.

following  situation:

i made a List with with following code

<<toc-tabbed-internal-nav 'CodingGuideline' "sort[title]">>        



added some Tiddlers with the Tag 'CodingGuideline'

so they appear as a list ..so far so good.
but there is one thing that bothers me the order ist not correct

it looks something like this

Coding Guideline 
  1. Topic number 2
  2. Topic number 1
  3. Topic number 3

How do i get it in the right oder


  1. Topic number 1
  2. Topic number 2
  3. Topic number 3

I saw there is something called sort[title] but i dont manage to get it to work


any help would be appreciated

thank you

Jed Carty

unread,
Oct 26, 2016, 4:53:40 AM10/26/16
to TiddlyWiki
I don't see anything that would be wrong with what you have. The sorting is pretty primitive though. Are your tiddlers actually called 'Topic number n'? Using 'sort' gives an alphabetical sort and will put numbers in the wrong order, like 1 10 11 12 2 20 21 3 4 5 and so on, so that may be your problem. Otherwise I am not sure.

ZEN

unread,
Oct 26, 2016, 5:16:30 AM10/26/16
to TiddlyWiki


Am Mittwoch, 26. Oktober 2016 10:53:40 UTC+2 schrieb Jed Carty:
I don't see anything that would be wrong with what you have. The sorting is pretty primitive though. Are your tiddlers actually called 'Topic number n'? Using 'sort' gives an alphabetical sort and will put numbers in the wrong order, like 1 10 11 12 2 20 21 3 4 5 and so on, so that may be your problem. Otherwise I am not sure.

no they don't have a number 'n' in them, the names right now  are something like:

1. Layout
2. Name
3. Blocks

what i want is

1.Name
2.Blocks
3.Layout

i don't wont to sort them alphabetical

thanks for the reply

p.S. what you mean by primitive is there a better way?



 

Jed Carty

unread,
Oct 26, 2016, 5:25:15 AM10/26/16
to TiddlyWiki
I just mean that it uses the basic javascript sort mechanism. It is possible to make something that will both sort alphabetically and keep numbers in the correct order for names like 'task 1', 'task 2' etc., but we don't have that. This causes some confusion every so often. nsort will sort numbers correctly and if there are items that don't start with numbers they will be added to the end and sorted alphabetically. But it would still put things in the order 'task 1' 'task 15' 'task 2'.

What you should probably do is give your tiddler a field called something like 'order' and then instead of "sort[title]" put "nsort[order]", then in each tiddler you set the order field to the position in the table of contents you want to give that tiddler.

ZEN

unread,
Oct 26, 2016, 5:45:06 AM10/26/16
to TiddlyWiki


Am Mittwoch, 26. Oktober 2016 11:25:15 UTC+2 schrieb Jed Carty:
I just mean that it uses the basic javascript sort mechanism. It is possible to make something that will both sort alphabetically and keep numbers in the correct order for names like 'task 1', 'task 2' etc., but we don't have that. This causes some confusion every so often. nsort will sort numbers correctly and if there are items that don't start with numbers they will be added to the end and sorted alphabetically. But it would still put things in the order 'task 1' 'task 15' 'task 2'.

What you should probably do is give your tiddler a field called something like 'order' and then instead of "sort[title]" put "nsort[order]", then in each tiddler you set the order field to the position in the table of contents you want to give that tiddler.

thank you so much ...thats exactly what i was looking for!
i have one more thing that is bugging me a bit, it is caused by
toc-tabbed-internal-nav but i guess i have to open a new topic



 

Tobias Beer

unread,
Oct 26, 2016, 7:10:33 AM10/26/16
to TiddlyWiki
Hi ZEN,

The recommened way to do this with TiddlyWiki
is to define a list field at CodingGuideline
in which you list all tagged tiddlers
in the order you want them retrieved.

Best wishes, 

Tobias.

Philippe Le Toquin

unread,
Oct 27, 2016, 11:57:22 AM10/27/16
to TiddlyWiki
Sorry to jump on this thread. It was exactly what I was looking as well.

I have 2 more questions for your Tobias.

How to list a tiddler that contains several words in the title?

With the list field I can now arrange my main TOC as I want but how do I order the items in each of the main section?

thanks
Philippe

stevesuny

unread,
Oct 27, 2016, 2:46:38 PM10/27/16
to TiddlyWiki
Hey all, 

Re: Use of list field to maintain sort order -- Personally I find that somewhat annoying to maintain, as one has to constantly update the list field of the root (tag) tiddler, which becomes problematic when changing the names of tiddlers to be sorted. For that reason I have begun using field & nsort approach more frequently; also this allows the possibility of numbering your sorted tiddlers as though they were line numbers in old code (100, 110, 120, 130, etc.) allowing you to "fill in" (101, 111) later in case you need to insert tiddlers into a sequence.

Re: listing (in list field, I would imagine) a tiddler whose name contains a space: [[Name of Tiddler]] will work. Drag/Drop from recent list into list field works as well; be careful to insert a space between ]][[ characters (why is that required?)

And you could use the same approach to ordering items in sub-sections of the TOC. Here is one way: [[TiddlerName]] (outline-order field value)

* [[Outline TopLevel 1 (outline-order:100)
** [[Level 1.1]]  (outline-order: 110)
** [[Level 1.2]] (outline-order: 120)
** [[Level 1.3]] (outline-order: 130)
* [[Outline Level2 (outline-order 200)
** [[Level 2.1]] (outline-order: 210)
** [[Level 2.2]] (outline-order: 220)
** [[Level 2.3]] (outline-order: 230)


This gets complicated for larger multi-level outlines: this would be a good usecase for the xlsx importer, or perhaps for a future word importer that reads outline levels from the style sheet :)

//steve.

Philippe Le Toquin

unread,
Oct 27, 2016, 3:50:35 PM10/27/16
to TiddlyWiki
Thanks Steve.

There is something strange.

I have several Tiddlers whose name contains a space. I can't seem to make it works. The only way I can make it works is if I put one of these tiddler at the end of the list. Then that tiddler gets moved but if I had another 2 words tiddler in that list then it doesn't affect it.

Philippe

Tobias Beer

unread,
Oct 28, 2016, 2:22:31 AM10/28/16
to TiddlyWiki
Hi Philippe,
 
How to list a tiddler that contains several words in the title?

Philippe Le Toquin

unread,
Oct 28, 2016, 6:01:38 AM10/28/16
to tiddl...@googlegroups.com
Thanks Tobias

I have read it but must admit that I am a bit confused sometime by the documentation. Probably is more to do with me but I sometime feel that a lot is assumed when it comes to the documentation.

I think I will a open a new discussion since it is now diverting from the original post.

Edit: as I was writing my new post it turns out that this morning all is working as expected!!! may be restarting Firefox helped?
Reply all
Reply to author
Forward
0 new messages