| 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> — Name of data group being filtered. '''''{{Color|New|Required}}''''' |
| |label =
| | * <code>2</code> / <code>value</code> — Comma separated list of possible values for the data group |
| |1 = | | * <code>3</code> / <code>display</code> — Comma separated list of corresponding displays for the values (e.g., an icon) |
| |query1 =
| | * <code>4</code> / <code>default</code> — Comma separated list of default applied filters |
| |2 = | |
| |query2 =
| |
| |3 = | |
| |query3 = | |
| }} | |
| </syntaxhighlight> | |
| * {{F|column}} – Table column number that will be queried for the filter. | |
| * {{F|mode}} – Set to:
| |
| ** {{F|exact}} for an "exact" filter.
| |
| ** {{F|contains}} for a "contains" filter.
| |
| * {{F|label}} – Text label for filters. | |
| * {{F|((n))}} – Text displayed on the ''n''-th filter button. | |
| * {{F|query((n))}} – 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> | |
| }} | | }} |
| | |} |