A slight mod to Jed McCarty's (iirc) code for clickable table column
headers-- basically tacking on a second line/field value within a table
cell that is independent from from the first line in the table cell and
both are independently sortable by mouse click.
For a result like this:
(shortened version shown, this is normally used with 10 column tables)
----------------------------------------------------------------------------------
NAME | City section |
ALIAS | Neighborhood |
----------------------------------------------------------------------------------
Name 1 | city section for Name 1 |
Alias for Name 1 | neighborhood for Name 1 |
----------------------------------------------------------------------------------
Name 2 | city section for Name 2 |
Alias for Name 2 | neighborhood for Name 2 |
----------------------------------------------------------------------------------
NAME, ALIAS, City section & Neighborhood are separate buttons within the
table header cells, separately sorting their respective values (which are
separate field values within the table cells, which keeps them in the same
table row)
Using the tiddler "title" field and 3 custom fields ("secondaryname",
"location", "location2"),
this mod just adds a line break and second sort button to the header
cells...
<th><$button class='tc-btn-invisible'
style='width:100%;height:100%'>Name<$action-setfield
sort_by='title'/><<ToggleDirection>></$button><br/>
<$button class='tc-btn-invisible'
style='width:100%;height:100%'>Alias<$action-setfield
sort_by='secondaryname'/><<ToggleDirection>></$button></th>
and a second field value to the table cells for that column
<td><$link><$view field="title"/></$link><br/><$view
field="secondaryname"/></td>
complete table code
\define FilterYOURFILTERNAME()
[tag[*YOURTAGNAME]$(SortType)$sort{!!sort_by}]
\end
\define ToggleDirection()
<$list filter='[<currentTiddler>sort_type[!]]'
emptyMessage="""<$action-setfield sort_type='!'/>""">
<$action-setfield sort_type=''/>
</$list>
\end
<$set name=SortType filter='[<currentTiddler>get[sort_type]]'>
<table>
<tr>
<th><$button class='tc-btn-invisible'
style='width:100%;height:100%'>Name<$action-setfield
sort_by='title'/><<ToggleDirection>></$button><br/>
<$button class='tc-btn-invisible'
style='width:100%;height:100%'>Alias<$action-setfield
sort_by='secondaryname'/><<ToggleDirection>></$button></th>
<th><$button class='tc-btn-invisible' style='width:100%;height:100%'>City
section<$action-setfield
sort_by='location'/><<ToggleDirection>></$button><br/><$button
class='tc-btn-invisible'
style='width:100%;height:100%'>Neighborhood<$action-setfield
sort_by='location2'/><<ToggleDirection>></$button></th>
</tr>
<$list filter=<<FilterYOURFILTERNAME>>>
<tr>
<td><$link><$view field="title"/></$link><br/><$view
field="secondaryname"/></td>
<td><$view field="location"/><br/><$view field="location2"/></td>
</tr>
</$list>
</table>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/0a36137b-4e28-43f2-a621-986f646de59f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.