Hello, I have been using Jed McCarty's code for clickable table column
headers to create sortable tables.
I recently put together a table to keep track of my various ebooks and from
whih vendor I purchased them. See code below.
\define SortableFilters()
[tag[EBook]has[vendor]$(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%'>
Title
<$action-setfield sort_by='title'/>
<<ToggleDirection>>
</$button>
</th>
<th>
<$button class='tc-btn-invisible' style='width:100%;height:100%'>
Author
<$action-setfield sort_by='author'/>
<<ToggleDirection>>
</$button>
</th>
<th>
<$button class='tc-btn-invisible' style='width:100%;height:100%'>
Vendor
<$action-setfield sort_by='vendor'/>
<<ToggleDirection>>
</$button>
</th>
</tr>
<$list filter=<<SortableFilters>>>
<tr>
<td>
//<$link to={{!!title}}><$view field="title"/></$link>//
</td>
<td>
<$view field='author'/>
</td>
<td>
<$view field='vendor'/>
</td>
</tr>
</$list>
</table>
</$set>
I have noticed that, after sorting the table by a column, the secondary
sort is always by title. So if I sort the list by vendor, the books are
listed within that sort alphabetically. As this is a library index, it
would be more appropriate if I could have the secondary sort default to the
author field, rather than the tiddler titles.
Is there any way I might be able to change the behavior of the table, so
that it will sort by a specific field rather than the title, after I have
used the proper sort_by?
Any suggestions would be very much appreciated.
Thank you.
--
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/c3b2526e-d7c8-41cd-8d88-965abf30312b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.