Question
We had a request to allow the "Recent Changes" table to be sortable by columns other than modified date.
Environment
--
PankajPant - 30 Jun 2005
Answer
Rather than changing the search template, we changed
WebChanges to use
FormattedSearch instead. The results are now formatted as a single TWiki table, which allows sorting by any column. Off course, this only applies to recent changes, not generic searches.
Here are the contents of the topic:
%STARTINCLUDE%
<div id="searchtable">
%N% Click on a column heading to sort the results by topic name or modifier name (instead of modified date). Click the heading again to reverse the sort.
%TABLE{ sort="on" tableborder="0" cellpadding="5" cellspacing="0" headerbg="white" headercolor="black" databg="white" headerrows="1" footerrows="0" }%
%SEARCH{".*" web="%INCLUDINGWEB%" regex="on" nosearch="on" order="modified" reverse="on" limit="%URLPARAM{"limit" default="50"}%" header ="| *Topic* | *Changed<br>(now %DISPLAYTIME{"$hou:$min"}%)* | *Changed by* |" format="|<a href=$topic title=$topic>$topic(40, ...)</a><br>$summary(80) |$date - $percntCALC{$IF($EXACT(1.1, $rev), <b>NEW</b>, r$rev [[%SCRIPTURL%/rdiff%SCRIPTSUFFIX%/$web/$topic (diff)]])}$nop% |$wikiusername |" }%</div>
* See [[%SCRIPTURL%/view%SCRIPTSUFFIX%/%INCLUDINGWEB%/%INCLUDINGTOPIC%?limit=100][100]], [[%SCRIPTURL%/view%SCRIPTSUFFIX%/%INCLUDINGWEB%/%INCLUDINGTOPIC%?limit=200][200]], [[%SCRIPTURL%/view%SCRIPTSUFFIX%/%INCLUDINGWEB%/%INCLUDINGTOPIC%?limit=400][400]], [[%SCRIPTURL%/view%SCRIPTSUFFIX%/%INCLUDINGWEB%/%INCLUDINGTOPIC%?limit=800][800]] most recent changes
* See [[%SCRIPTURL%/view%SCRIPTSUFFIX%/%INCLUDINGWEB%/%INCLUDINGTOPIC%?limit=all][all]] changes
<style>
#searchtable th {
font-size: 125%;
border-top: 3px solid #8caae6;
border-bottom: 3px solid #8caae6;
}
#searchtable {
padding-bottom: 1em;
border-bottom: 3px solid #8caae6;
}
#searchtable th A:link, th A:visited, th A:active { text-decoration: none; }
#searchtable th A:hover { text-decoration: underline; }
</style>
%STOPINCLUDE%
Here are some details:
- CSS markup is used to make the results look somewhat similar to the original search results.
- The topic name is truncated to eliminate the "page dropping down in IE" issue in BlueSkin. The full name is shown as a tooltip on mouse hover. This is identical to the Outlook behavior for long subject lines.
- The topic summary is not in a separate row anymore, since that messes up the sorting.
- The revision summary is presented as
DATE - TIME - REV (diff)
, to keep the sorting consistent.
I'm just posting this here in case someone else has desired a similar functionality. Also, wondering whether this was the right way to go, or if there are suggestions for better methods?
--
PankajPant - 30 Jun 2005
Thanks, Pankaj! I moved your tip to the
TWikiTips as
TWikiTip032
--
CrawfordCurrie - 02 Jul 2005