Module:FilterBuilder/doc

From Love and Deepspace Wiki

This is the documentation page for Module:FilterBuilder

Documentation

Description[edit source]

Builds a filter with specified parameters to use for filtering lists and tables. Multiple parameters can be used for one option by adding ";;" between filter values.

The Javascript and CSS are located at MediaWiki:Gadget-listFilter.js and MediaWiki:Gadget-listFilter.css and also requires mw:Extension:Gadgets to function (or copy-paste to MediaWiki:Common.js and MediaWiki:Common.css).

Other Requirements

  • The element you're sorting must have the class filter-element
  • The element you're sorting must have the attribute data- on it. For example, if your data key is color, then your filter-element must have attribute data-color

Usage[edit source]

{{#invoke:FilterBuilder|filterBuilder|<data key>|<filter values>|<filter icons/text>}}

Example[edit source]

  • Filter with single values and text labels
{{#invoke:FilterBuilder|filterBuilder|slotType|Lunar,Solar|Lunar,Solar}}
Lunar
Solar


  • Filter with single values and image labels
{{#invoke:FilterBuilder|filterBuilder|slotType|Lunar,Solar|[[File:Lunar icon.png|30px|link=]],[[File:Solar icon.png|30px|link=]]}}



  • Filter with multiple values (For this example, if you choose "Shades of Red" and if your filter-element has a data-color of Red, Pink, Rose or Salmon, it will get picked up in the filtered list.)
{{#invoke:FilterBuilder|filterBuilder|color|Red;;Pink;;Rose;;Salmon,Blue;;Cyan;;Teal|Shades of Red,Shades of Blue}}
Shades of Red
Shades of Blue