Function: RenderBarFilterWithSort

Bar with sort and filter options

Documentation

TODO

Parameters
  • FACETS - Required Specify what "facets" in include as filters. Defaults to the contents of "Facets" field in base topic.
  • INITSORT -Required Initial sort. set to either "created" or "modified"
  • INITLIMIT - Required Initial results # limit. Set to 10, 20, 50, 100, or all.
  • Note: if you are using this in conjunction with RenderSearchString, you can simplify things by defining these parameters within the base topic.

Css

Implementation

%STARTINCLUDE%<noautolink>
#FilterBar
<form name="filterList" action="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%BASEWEB%/%BASETOPIC%#FilterBar" >
~~~     <div style="padding:.5em .5em 2em .5em;color:#666;background-color:#FCF8EC;font-size:94%;margin:0 0 0 0;">
~~~     <div class="foswikiLeft">
~~~     *Sort by:*  <select name="sort" onchange="submit();" > 
*~~       <option value="modified" %IFDEFINED{"%URLPARAM{"sort" default="%INITSORT%"}%" as="modified" then="selected" glue="off"}% >
*~~                Last Modified</option>
*~~        <option value="name" %IFDEFINED{"%URLPARAM{"sort" default="%INITSORT%"}%" as="name" then="selected" glue="off"}% >
*~~                Title</option>
*~~       <option value="date" %IFDEFINED{"%URLPARAM{"sort" default="%INITSORT%"}%" as="date" then="selected" glue="off"}% >
*~~                Date Created</option>
*~~       <option value="author" %IFDEFINED{"%URLPARAM{"sort" default="%INITSORT%"}%" as="author" then="selected" glue="off"}% >
*~~                Author</option>
~~~      
%~~     FORMATLIST{"%FACETS%" 
~~~          separator=" "
~~~          format="<option $percntIFDEFINED{\"%URLPARAM{"sort" default="%INITSORT%"}%\" as=\"$1\" then=\"selected\" glue=\"off\"}$percnt >
*~~               $1</option>" 
~~~      }%  
*~~     </select>&nbsp;&nbsp;
%~~   IFDEFINEDTHEN{"%FACETS%" glue="off"  }%  <b>Filter by:</b> 
~~~  
%~~     FORMATLIST{"%FACETS%"
~~~         separator=" " 
~~~       format="<select name=\"$1\" size=\"1\"  onchange=\"submit();\" > <option value=\"\">$percntIF{\"$'URLPARAM{$1}' != ''\" then=\"All $1s\" else=\"<nop>$1...\" }$percnt</option> 
~~~           $percntDBQUERY{\"$percntFORMFIELD{\"Classification\" topic=\"%BASEWEB%.$1\" }$percnt='$1'\" web=\"%BASEWEB%\" 
~~~              format=\"<option $dollarpercntIF{\\"$'URLPARAM{$1}'='$topic'\\" then=\\"selected\\" else=\\" \\"}$dollarpercnt>$topic</option>\" 
~~~       separator=\" \" }$percnt</select>" 
~~~      }%  
~~~      %FIDEFINED%
~~~     </div><!-- foswikiLeft -->
*~~     <div class="foswikiRight">
~~~     *Limit To:* <select name="limit" onchange="submit();" > 
~~~         <option %IFDEFINED{"%URLPARAM{"limit" default="%INITLIMIT%"}%" as="10" then="selected" glue="off"}% >10</option>
~~~         <option %IFDEFINED{"%URLPARAM{"limit" default="%INITLIMIT%"}%" as="20" then="selected" glue="off"}% >20</option>
~~~         <option %IFDEFINED{"%URLPARAM{"limit" default="%INITLIMIT%"}%" as="50" then="selected" glue="off"}%>50</option>
~~~         <option %IFDEFINED{"%URLPARAM{"limit" default="%INITLIMIT%"}%" as="100" then="selected" glue="off"}%>100</option>
~~~         <option %IFDEFINED{"%URLPARAM{"limit" default="%INITLIMIT%"}%" as="all" then="selected" glue="off"}%>all</option>
~~~    </select> </div> 
*~~    </form></div><!-- bar styling --></noautolink><div class="foswikiClear"></div>%STOPINCLUDE%

Test

Sort by:    Filter by:
Limit To:

Calls to 'RenderBarFilterWithSort'

(C) 2006 LynnwoodBrown@Skyloom.com

This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For more details read the LICENSE.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Middle Fork Home Wiki? Send feedback
Syndicate this site RSS