Jump to content

Editing Template:Filter/doc

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
{{Documentation/Header}}
{{Documentation/Header}}
{{JS|Gadget-Filter|DataTables}}
{{Lua|FilterBuilder}}
{{CSS|Gadget-Filter}}
Template that creates a row of filters for fiterable tables. To be used in conjuction with {{T|Filter/Header}} and {{T|Filter/Footer}}.


==Syntax==
Template that creates filters for fiterable tables. To be used in conjuction with {{T|Filter/Header}} and {{T|Filter/Footer}}.
<syntaxhighlight lang="wikitext" copy>
 
{{Filter
==Usage==
|column =
<pre>{{Filter|<1>|<2>|<3>|<4>}}</pre>
|all = true
This template has up to 4 unnamed parameters:
|mode =
* <code>1</code> &mdash; Name of data group being filtered. '''''{{Color|New|Required}}'''''
|label =
* <code>2</code> / <code>value</code> &mdash; Comma separated list of possible values for the data group
|1 =
* <code>3</code> / <code>display</code> &mdash; Comma separated list of corresponding displays for the values (e.g., an icon)
|query1 =
* <code>4</code> / <code>default</code> &mdash; Comma separated list of default applied filters
|2 =
|query2 =
|3 =
|query3 =
}}
</syntaxhighlight>
* {{F|column}} &ndash; Table column number that will be queried for the filter.
* {{F|mode}} &ndash; Set to:
** {{F|exact}} for an "exact" filter.
** {{F|contains}} for a "contains" filter.
* {{F|label}} &ndash; Text label for filters.
* {{F|((n))}} &ndash; Text displayed on the ''n''-th filter button.
* {{F|query((n))}} &ndash; Text that will be queried upon pressing the ''n''-th filter button


==Example==
==Example==
{{Filter/Header|id=neighbor-list|type=neighbors}}
{{Filter/Header|message=Click on the buttons to apply a filter to the list of [[creature]]s.}}
{{Filter
{{Filter|category|Fish,Insects,Shore-Dwellers|Fish,Insects,Shore-Dwellers|}}
|column = 4
{{Filter|reset}}
|all = true
|mode = contains
|label = Galaxy:
|1 = [[File:Hexia Icon.png|30px|link=|class=day-invert-image]]
|query1 = Hexia
|2 = [[File:Taffeh Icon.png|30px|link=|class=day-invert-image]]
|query2 = Taffeh
|3 = [[File:Norvan Icon.png|30px|link=|class=day-invert-image]]
|query3 = Norvan
}}
{{Filter
|column = 5
|all = true
|label = Pronouns:
|1 = He/Him
|2 = She/Her
}}
{{Filter/Footer}}
{{Filter/Footer}}
{{#invoke:Bucket|get|neighbors
{| class="wikitable sortable"
|select = page_name, birthday, role, galaxy, pronouns, loves, likes, dislikes
|-
|where = {{{where|}}}
! Icon
|filter = {{{filter|}}}
! Creature
|order by = page_name
! Category
 
{{#DPL:
|format = userformat
|namespace=
|show resultsHeader = false
|uses=Template:Creature Infobox
|header = <!--
|category=Creatures
--><table id="neighbor-list" class="wikitable sortable"><!--
|include={Creature Infobox}:name,{Creature Infobox}:category,{Creature Infobox}:name,{Creature Infobox}:category
--><tr><!--
|format=,,,
--><th class="unsortable">Icon</th><!--
|secseparators=<tr class="filter-element" data-search="," data-category=",,"><td>[[File:%PAGE% Icon.png|x30px|link=%PAGE%]]</td><td>[[,,]]</td><td>,,</td></tr>
--><th>Name</th><!--
|ordermethod=sortkey
--><th>Role</th><!--
|count=40
--><th>Galaxy</th><!--
--><th>Pronouns</th><!--
--><th>Birthday</th><!--
--><th>Loves</th><!--
--><th>Likes</th><!--
--><th>Dislikes</th><!--
--></tr>
|userformat = <!--
--><tr><!--
--><td>{{Item|size=50|%page_name%|notext=1}}</td><!--
--><td>[[%page_name%]]</td><!--
--><td>%role%</td><!--
--><td><nowiki>{{#if:%galaxy%|{{Item|%galaxy%|invert=Day}}}}</nowiki></td><!--
--><td>%pronouns%</td><!--
--><td>%birthday%</td><!--
--><td><nowiki>{{Item List|%loves%}}</nowiki></td><!--
--><td><nowiki>{{List|%likes%}}</nowiki></td><!--
--><td><nowiki>{{List|%dislikes%}}</nowiki></td><!--
--></tr>
|footer = </table>
}}
}}
|}
Please note that all contributions to The Petit Planet Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see Petit Planet Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template
Below are commonly used wikitext from MediaWiki:Edittools. Click on any to insert them in the edit box.
File Pages==Summary====Licensing=={{Fairuse}}{{File|}}
Dynamic Page List¦²«»²{¦}²«»«/»«!----»
Array in DPL¹^2{}^2^2{¹}^2
Parser Functions{{#if:||}}
{{#ifeq:|||}}
{{#expr:}}
{{#switch:||#default=}}
{{#replace:||}}
{{#titleparts:}}
{{#tag:|}}
Markup{{}}|[][[]][[Category:]]#REDIRECT [[]] [[Category:Redirect Pages]]<code></code><includeonly></includeonly><noinclude></noinclude><nowiki></nowiki><!----><br>§
Notices{{Stub|}}{{Stub Dialogue}}{{Upcoming}}{{Under Construction}}{{Placeholder|}}
Magic Words{{!}}{{formatnum:}}{{lc:}}{{uc:}}{{PAGENAME}}{{FULLPAGENAME}}{{ROOTPAGENAME}}{{BASEPAGENAME}}{{SUBPAGENAME}}{{DISPLAYTITLE:|noreplace}}__TOC____NOTOC____EXPECTUNUSEDCATEGORY____HIDDENCAT__
HTML Entities&mdash;&nbsp;&comma;&shy;

This page is a member of a hidden category: