Sep 23, 2019

Tiddlywiki Sortable Static Tables

This is a cool hack for TiddlyWiki that allows all tables to be sorted with a browser page reload. However it does not lend any data capabilities to the tables.

Steps:

  1. Open your Tiddlywiki
  2. Open the control panel ($:/ControlPanel)
  3. Go to tab: Settings
  4. Go to heading: Navigation Address Bar
  5. Select the radial button: "Include the target tiddler and the story sequence"
  6. Download the sorttable.js file contents: here
  7. Create a new tiddler to save the Javascript:
    1. Name it whatever you want to
    2. Add a field: module-type
    3. Give the field the value: widget
    4. Set the tiddler type to: application/javascript
    5. Insert and save the contents of sorttable.js inside that tiddler
  8. Create another new tiddler (to become a snippet)
    1. Name it whatever you want to
    2. Add the tag: "$:/tags/TextEditor/Snippet" (without quotes)
    3. Save the following text as the snippet: (snippets appear in the edit bar as insertable text)
|sortable|k
|Reload page for sorting|c
|Footer|Footer|f
|Header|Header|h
|Cell1 |Cell2 |
|Cell3 |Cell4 |
 


This snippet sets the caption, header, and footer above the lowest table row so that new table rows can be added easily.

The caption reads, "Reload page for sorting". This is because this javascript only allows one to sort the tables upon a page reload via the browser. We changed the option to target the tiddler and story sequence, because otherwise your open tiddlers would disappear upon a page reload.

Edits 04/2020: Based on this Reddit comment

No comments:

Post a Comment