Template:Filter/doc: Difference between revisions
mNo edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
{{Documentation/Header}} | {{Documentation/Header}} | ||
{{ | {{JS|Gadget-Filter|DataTables}} | ||
{{CSS| | {{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}}. | |||
Template that creates filters for fiterable tables. To be used in conjuction with {{T|Filter/Header}} and {{T|Filter/Footer}}. | |||
==Syntax== | ==Syntax== | ||
< | <syntaxhighlight lang="wikitext" copy> | ||
{{Filter | |||
* | |column = | ||
* | |all = true | ||
* | |mode = | ||
* | |label = | ||
|1 = | |||
|query1 = | |||
|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|type=neighbors}} | |||
{{Filter/Header| | {{Filter | ||
{{Filter | |column = 4 | ||
|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 | |||
|select = page_name, birthday, role, galaxy, pronouns, loves, likes, dislikes | |||
|where = {{{where|}}} | |||
|filter = {{{filter|}}} | |||
|order by = page_name | |||
{{# | |||
| | |format = userformat | ||
| | |show resultsHeader = false | ||
| | |header = <!-- | ||
| | --><table id="neighbor-list" class="wikitable sortable"><!-- | ||
|format = | --><tr><!-- | ||
| | --><th class="unsortable">Icon</th><!-- | ||
| | --><th>Name</th><!-- | ||
| | --><th>Role</th><!-- | ||
--><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> | |||
}} | }} | ||