table content conditional formatting

64 views
Skip to first unread message

vpl

unread,
Jan 8, 2019, 10:26:28 AM1/8/19
to TiddlyWiki
Hi,

I struggle to find a way to display a table whose content layout is condioned by tiddler field

For example a table like the one below. I would like to highlight in red the 'topic' field (<$view field="topic"/>) if the tiddler has a tag "done"

<table><tbody>
<tr>
<th>Date</th><th>Topic</th><th>Title</th>
</tr>
    <$list filter="[tag[task]sort[topic]]">
    <tr>
        <td><$link><$view field="created" format="date" template="DD/0MM/YY"/></$link></td>
        <td><$view field="topic"/></td>
        <td><$view field="title"/></td>
    </tr>
</$list></tbody></table>

I can't find anything that could help me ... but not a tiddlywiki expert

Thanks for your help

Regards

Vpl

Mark S.

unread,
Jan 8, 2019, 11:09:05 AM1/8/19
to TiddlyWiki

You can apply the tags as classes like this:

table><tbody>
<tr>
<th>Date</th><th>Topic</th><th>Title</th>
</
tr>
   
<$list filter="[tag[task]sort[topic]]">

   
<tr class={{!!tags}}>

       
<td><$link><$view field="created" format="date" template="DD/0MM/YY"/></$link></td>

       
<td class="showstatus"><$view field="topic"/></td>

       
<td><$view field="title"/></td>
   
</tr>
</
$list></tbody></table>

And then a stylesheet (tiddler tagged with $:/tags/Stylesheet) like this:

tr.done td.showstatus {
color
: red;
}

-- Mark

vpl

unread,
Jan 9, 2019, 3:46:28 AM1/9/19
to TiddlyWiki
Hi Mark

Magic !! 

Thanks very much for your help and so quick answer ..

Vpl
Reply all
Reply to author
Forward
0 new messages