From 52d32fe3fdb4eed2776ca1373179869d19a6decf Mon Sep 17 00:00:00 2001 From: Marxsal Date: Fri, 16 Dec 2016 09:47:08 -0800 Subject: [PATCH] Howto1 (#2659) * Create One weird trick to change the sort order of sub-branches in a TOC macro * Update and rename One weird trick to change the sort order of sub-branches in a TOC macro to How to change the sort order of sub-branches in a TOC macro * Added .tid to file name * Delete How to change the sort order of ... The correct version is the one with the .tid file extension --- ...t order of sub-branches in a TOC macro.tid | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 editions/tw5.com/tiddlers/howtos/How to change the sort order of sub-branches in a TOC macro.tid diff --git a/editions/tw5.com/tiddlers/howtos/How to change the sort order of sub-branches in a TOC macro.tid b/editions/tw5.com/tiddlers/howtos/How to change the sort order of sub-branches in a TOC macro.tid new file mode 100644 index 000000000..76dbfcbf6 --- /dev/null +++ b/editions/tw5.com/tiddlers/howtos/How to change the sort order of sub-branches in a TOC macro.tid @@ -0,0 +1,27 @@ +created: 20161209172820513 +modified: 20161209174234840 +tags: Learning +title: How to change the sort order of sub-branches in a TOC macro +type: text/vnd.tiddlywiki + +Imagine that you are using a [[Table of Contents|Table-of-Contents Macros]] macro similar to this: + +``` +<> +``` + +The sorting is fine for most cases, but you would like all your items tagged `Journal` to be sorted by the `created` field. How can you apply a separate sort order to just those sub-items tagged `Journal`? + +The trick is to add a field to the parent tagging tiddler (i.e. `Journal`) that points to a different sort criteria. Let's call the field `fuzzy`, and populate it with the value `created` (`created `is the name of the field that contains a tiddler's creation date). + +Now change your [[Table of Contents|Table-of-Contents Macros]] to look like this: + +``` +<> +``` + +Now your Table of Contents will sort by title everywhere, except for the children of the `Journal` tiddler, which will sort by the `created `date. + +The downside to this trick is that you can't apply a reverse sort based on just one special field. If you reverse the sort order, it will be reversed everywhere. + +