Using List to populate column

241 views
Skip to first unread message

Regan Jackson

unread,
Sep 29, 2014, 10:44:06 PM9/29/14
to tiddl...@googlegroups.com
Hello,

I am very new to Tiddlywiki, forgive my ignorance.

What I want to do is populate a column in a table with a list of tiddlys with the same tab name(auto updated).

For example

I have 5 tiddlers tagged as 'tagName'

----
I've create a tiddly with just the list of TiddlyNames

ListTagNameTiddly

{{{[tag[tagName]]}}}

which outputs
 TiddlyName1
 TiddlyName2
 TiddlyName3

etc

---
I would like column A to be numbered and column B to show the name of the tiddly tagged with 'tagName', and possibly a 3rd column that is blank.

|1 | tid1|
|2 | tid2|
|3 | tid3|
|4 | tid4|
|5 | tid5|

Is there an easy way to do this?

Michael Wiktowy

unread,
Sep 29, 2014, 11:47:56 PM9/29/14
to tiddl...@googlegroups.com

It is not straightforward but the simplest way that I have found is using this structure where you want you table that runs the filter results through a template:
<table>
<tr>
<th>Column 1 Heading</th>
<th>Column 2 Heading</th>
<th>Column 3 Heading</th>
</tr>
{{{[!has[draft.of]tag[tag_of_interest]field:field_of_interest[value_to_match]sort[]]||expandTable}}}
</table> 
Where expandTable is another tiddler containing simply:
<tr>
<td>''{{!!field_to_populate_column_1}}''</td>
<td>''{{!!field_to_populate_column_2}}''</td>
<td align="right">''{{!!field_to_populate_column_3_but_right_aligned}}''</td>
</tr>

Not exactly what you wanted but you likely can get the results you need ... although I am not sure how you would autoincrement the number for column 1. Maybe you can mix in some ordered list elements in there somewhere ... not sure.

Hope this helps.
/Mike

Danielo Rodríguez

unread,
Sep 30, 2014, 3:44:29 AM9/30/14
to tiddl...@googlegroups.com
Why a table?

Why not a numbered list?

<$list filter="[tag[tagName]]">
# <$view field="title"/>
</$list>

PMario

unread,
Sep 30, 2014, 5:11:10 AM9/30/14
to tiddl...@googlegroups.com
On Tuesday, September 30, 2014 4:44:06 AM UTC+2, Regan Jackson wrote:
I would like column A to be numbered and column B to show the name of the tiddly tagged with 'tagName', and possibly a 3rd column that is blank.

|1 | tid1|
|2 | tid2|
|3 | tid3|
|4 | tid4|
|5 | tid5|

Is there an easy way to do this?

The auto increment counter is the problem here. There is no such function atm. ... Is there a reason for the numbering.
With TW the order is dynamic. So if you add a tiddler to the list, it may be at any position. ...

-mario

Stephan Hradek

unread,
Sep 30, 2014, 6:16:13 AM9/30/14
to tiddl...@googlegroups.com
Create a tiddler "rowcount" containing:

table {
  counter
-reset: rowcount;
}
tr
{
  counter
-increment: rowcount;
}
span
.counter:before {
  content
:counter(rowcount);
}



and tagged as $:/tags/Stylesheet.

Put into your cell where you want the counter

<span class=""counter"/>



Stephan Hradek

unread,
Sep 30, 2014, 6:17:04 AM9/30/14
to tiddl...@googlegroups.com
Small typeo:

<span class="counter"/>

Danielo Rodríguez

unread,
Sep 30, 2014, 6:48:54 AM9/30/14
to tiddl...@googlegroups.com
An example tiddler using this would be:

<table>
<$list filter="[tag[TableOfContents]]">
<tr><td><span class="counter"/></td><td><$view field="title"/></td></tr>
</$list>
</table>

Stephan, this is awesome. Your knowledge of web technologies amazes me on each iteration.

Julio Peña

unread,
Sep 30, 2014, 4:39:48 PM9/30/14
to tiddl...@googlegroups.com
Hello Danielo and all,

And if you want the numbering to appear as headings on the table do this:

<table>
<$list filter="[tag[change]]">
<tr><th><span class="counter"/></th><td><$view field="title"/></td></tr>
</$list>
</table>

It gives it a nice effect.
You can see my testing here: http://jpentw5.tiddlyspot.com/


Best regards,

Julio

aamaadmi

unread,
Oct 1, 2014, 2:46:14 AM10/1/14
to tiddl...@googlegroups.com
little correction on your site

```
<table>
<$list filter="[tag[change]]">
<tr><th><span class="counter"/></th><td><$link to={{!!title}}><$view field="title"/></%link></td></tr>
</$list>
</table>
```

% ---> $

Julio Peña

unread,
Oct 1, 2014, 11:30:50 AM10/1/14
to tiddl...@googlegroups.com
Hello aamaadmi,

Oh dear lord, many thanks for catching that!


Best regards,

Julio

TJ Hoeft

unread,
Apr 17, 2015, 2:51:17 PM4/17/15
to tiddl...@googlegroups.com
All,
Thank you for your posts!  They are very helpful.  I'm trying to render links to Tiddlers from Tiddler name references stored within a table.  I modified your example to store an extra field for an appointment date.

<table>
<$list filter="[tag[future-plan]]">
<tr><td><span class="counter"/></td><td><$view field="title"/></td><td><$view field="follow-up-date"/></td></tr>
</$list>
</table>

The above works great, but no hyperlink to the corresponding tiddler.  So I tried the modification below.

<table>
<$list filter="[tag[future-plan]]">
<tr><td><span class="counter"/></td><td><$link to={{!!title}}><$view field="title"/></link></td><td><$view field="follow-up-date"/></td></tr>
</$list>
</table>

While it is hyperlinked, this code produces tag artifacts in the rendered view.  Any ideas on how to clean this up?

TJ
Reply all
Reply to author
Forward
0 new messages