Generate table with tiddler fields as columns

128 views
Skip to first unread message

Pin Tail

unread,
Mar 9, 2018, 5:16:48 AM3/9/18
to TiddlyWiki
Hello,

I'm currently trying to generate a table from a filter. Each of the tiddlers returned by the filter represents a song, and has a number of additional fields - "artist", "album", "length" and so on. I'd like to be able to produce a table of the songs which match a filter with a column for each of the relevant fields. Ideally it would also be possible to sort the table by any one of those fields (as is possible for tables entered manually using wikitext).

Having spent a while searching and playing with lists, I'm not getting anywhere. Anyone know how I can approach this?

Best,

Pintail

Jed Carty

unread,
Mar 9, 2018, 6:37:06 AM3/9/18
to TiddlyWiki
I made a plugin that does that here: 

Jed Carty

unread,
Mar 9, 2018, 6:37:18 AM3/9/18
to TiddlyWiki

Pin Tail

unread,
Mar 9, 2018, 11:00:54 AM3/9/18
to TiddlyWiki
Thanks so much - just what I was looking for!

Is there any way I can make it so that the rows of the table link to the tiddlers themselves?

Mark S.

unread,
Mar 9, 2018, 11:42:48 AM3/9/18
to TiddlyWiki
That's so good it should be bookmarked at TiddlyWiki.com (PR#3159)

-- Mark

Pin Tail

unread,
Mar 9, 2018, 10:28:25 PM3/9/18
to TiddlyWiki
In the end I figured out it's pretty simple to do this by modifying the following code from the Table Macros tiddler:

\define TableMacrosRowTableInnerInnerRows()
<$list filter='$(RowList)$+[sort{$(TableMacrosMakeTableSortStateTiddler)$}]' variable=ThisTiddler>
 
<tr>
   
<th>
     
<<ThisTiddler>>
   
</th>
    <$list filter=<<FieldsList>> variable=ThisField>
      <td>
        <<TableMacrosInlineEditButton>>
      </
td>
   
</$list>
  </
tr>
</$list>
\end

By replacing the fifth row above with:

<$link to=<<ThisTiddler>>><<ThisTiddler>></$link>

I also changed the <th> to a <td> as I don't like each row to start with a header.

Jed Carty

unread,
Mar 10, 2018, 4:32:35 AM3/10/18
to TiddlyWiki
I can add that as an option to the macro. I should clean it up and package them as a plugin on the ooktech plugin library so this is a good excuse to do that.
Reply all
Reply to author
Forward
0 new messages