Documentation
Parameters
- TYPE: the TopicType to be searched for, defaults to BASETOPIC
- FORM: the form definition of the TopicType, defaults to TYPE's DataForm definition
- FIELDS: columns of formfields to display, defaults to TopicTitle, Summary, WikiApplication, Changed
- HIDDENFIELDS: list of fields that are not shown
- SORT: sorting of rows, defaults to unsorted
- PAGING: boolean to enable/disable paged results, defaults to on
- INFO: boolean to enable/disable infos for results, defaults to on
- REVERSE: sorting direction, defaults to "off", defaults to "on" if SORT="Changed"
- ROWS: number of rows to display initially, defauts to 10
- FILTER: additional filter expression (optional)
- THEWEB: web to examin, defaults to BASEWEB
- TOPICS: list of topics to query per web, default: all
- SAVESTATE: save state of sorting and filtering, defaults to "on"
- SEARCHING: boolean to enable/disable, defaults to on
- ROWNUMBERS: boolean toggle to switch on/off row numbers
- ROWGROUP: column by which to group rows, default none
- ROWCLASS: javascript function to add a css class to the row
- ROWCALLBACK: javascript function to process rows
- SELECTING: boolean toggle to switch on/off row selection, defaults to off
- ORDERING: boolean toggle to switch on/off changing the sorting, defaults to on
- SEARCHMODE: either have one single search box using
global
or one per column using multi
, default global
- LENGTHMENU: list of numbers appearing in the length menu to change the page size, defaults to 5,10,15,20,25,30,40,50,100
- BUTTONS: list of buttons to show; possible values are
excel
, csv
, print
, pdf
and copy
- <field_name>_title: column title for the given field
- <field_name>_width: column width for the given field
Implementation
Using
JQDataTablesPlugin
%STARTINCLUDE%<noautolink>%DBCALL{
"%WEB%.%TOPIC%"
section="%IF{"context static" then="static" else="dynamic"}%"
}%</noautolink>%STOPINCLUDE%
static
%STARTSECTION{"dynamic"}%%DATATABLE{
connector="dbcache"
class="foswikiFlatTable foswikiStripes foswikiHideOnPrint"
form="%FORM{default="%DBCALL{"Applications.GetFormOfType" TYPE="%TYPE{default="%BASETOPIC%"}%"}%"}%"
query="TopicType=~'\b%TYPE{default="%BASETOPIC%"}%\b' %IF{"defined FILTER" then="AND %FILTER%"}%"
web="%THEWEB{default="%BASEWEB%"}%"
topics="%TOPICS{default=""}%"
topic="%BASEWEB%.%BASETOPIC%"
columns="%IF{"'%ROWNUMBERS{default="on"}%'='on'" then="index,"}%%FIELDS{default="TopicTitle,Summary,Changed,By"}%"
hidecolumns="%HIDDENFIELDS{default=""}%"
rowgroup="%ROWGROUP{default=""}%"
rowclass="%ROWCLASS{default=""}%"
rowcallback="%ROWCALLBACK{default=""}%"
rows="%ROWS{default="10"}%"
sort="%SORT{default="Changed"}%"
reverse="%REVERSE{default="%IF{"'%SORT{default="Changed"}%'='Changed'" then="on" else="off" }%"}%"
paging="%PAGING{default="on"}%"
savestate="%SAVESTATE{default="on"}%"
searching="%SEARCHING{default="on"}%"
ordering="%ORDERING{default="on"}%"
searchmode="%SEARCHMODE{default="global"}%"
width="100%"
info="on"
lengthmenu="%LENGTHMENU{default="%TOPICTYPE_LENGTHMENU{default="5,10,15,20,25,30,40,50,100"}%"}%"
buttons="%BUTTONS{default="%TOPICTYPE_BUTTONS{default=""}%"}%"
WikiApplication_title="%TRANSLATE{"Application"}%"
TopicTitle_title="%TRANSLATE{"Title"}%"
Summary_title="%TRANSLATE{"Summary"}%"
Changed_title="%TRANSLATE{"Changed"}%"
By_title="%TRANSLATE{"By"}%"
qmstate_title="%TRANSLATE{"Status"}%"
qmstate_progress_title="%TRANSLATE{"Progress"}%"
%FORMATLIST{"%FIELDS{default="TopicTitle,Summary,WikiApplication,Changed"}%"
split="\s*,\s*"
pattern="^[#\/]?(.*)$"
format="$percntIF{\"defined $1_title\"
then=\"$1_title=\\"$percnt$1_title$percnt\\"\"
}$percnt"
separator="$n"
}%
%FORMATLIST{"%FIELDS{default="TopicTitle,Summary,WikiApplication,Changed"}%"
split="\s*,\s*"
pattern="^[#\/]?(.*)$"
format="$percntIF{\"defined $1_width\"
then=\"$1_width=\\"$percnt$1_width$percnt\\"\"
}$percnt"
separator="$n"
}%
%IF{"'%SELECTING{default="off"}%'='on'"
then="selecting=\"on\" selectionmode=\"multi\" selectproperty=\"Topic\""
}%
}%%ENDSECTION{"dynamic"}%
static
%STARTSECTION{"static"}%%DBQUERY{
"TopicType=~'\b%TYPE{default="%BASETOPIC%"}%\b' %IF{"defined FILTER" then="AND %FILTER%"}%"
web="%THEWEB{default="%BASEWEB%"}%"
topics="%TOPICS{default=""}%"
reverse="%REVERSE{default="%IF{"'%SORT{default="Changed"}%'='Changed'" then="on" else="off" }%"}%"
sort="%SORT{default="info.date"}%"
header="<table class='foswikiTable foswikiFlatTable foswikiStripes foswikiFullWidth'>
<thead><tr>
%IF{"'%ROWNUMBERS{default="on"}%'='on'" then="<th></th>"}%
%FORMATLIST{
"%FIELDS{default="TopicTitle,Summary,Changed,By"}%"
exclude="%FORMATLIST{"%HIDDENFIELDS{default=""}%" header="^(" format="$1" separator="|" footer=")$"}%"
format="<th>$percntTRANSLATE{\"$1\"}$percnt</th>"
separator=""
replace="%FORMATLIST{
"%FIELDS{default="TopicTitle,Summary,Changed,By"}%"
format="$1=$percnt$1_title{default=\"$1\"}$percnt"
}%"
}%</tr></thead><tbody>"
footer="</tbody></table>"
separator=""
format="<tr>
%IF{"'%ROWNUMBERS{default="on"}%'='on'" then="<td><b>$index</b></td>"}%
%FORMATLIST{
"%FIELDS{default="TopicTitle,Summary,Changed,By"}%"
exclude="%FORMATLIST{"%HIDDENFIELDS{default=""}%" header="^(" format="$1" separator="|" footer=")$"}%"
format="<td>$percntIF{
\"'$1'='Changed'\" then=\"$formatTime(info.date, '$day $mon $year - $hour:$min')\"
}$percnt$percntIF{
\"'$1'='By'\" then=\"$expand(info.author)\"
}$percnt$percntIF{
\"'$1'='qmstate'\" then=\"$expand(qmstate.title)\"
}$percnt$percntIF{
\"'$1'='TopicTitle'\" then=\"[[$web.$topic][$expand(topictitle)]]\"
}$percnt$percntIF{
\"'$1'=~'^#'\"
then=\"[[$web.$topic][$displayValue($1)]]\"
}$percnt$percntIF{
\"'$1'=~'^(Changed|By|TopicTitle|qmstate)$'\"
else=\"$displayValue($1)\"
}$percnt</td>"
separator=""
}%</tr>"
}%%ENDSECTION{"static"}%
Test
topic |
index |
TopicTitle |
Summary |
WikiApplication |
Changed |