Module:FilterBuilder/doc
From Another Eden Wiki
This is the documentation page for Module:FilterBuilder
Documentation
[purge]
Description[edit]
Builds a filter with specified parameters to use for filtering lists and tables.
The elements being filtered must have the filter-element
class.
Usage[edit]
{{#invoke:FilterBuilder|filterBuilder|<dataKey>|<filter values>|<filter icons/text>|<selected by default filter values>}}
- dataKey is the data-* attribute the filter will be filtering the elements on. For example, if the data attribute is
data-color
, then you would putcolor
.- use for cases with simple searchable one DataValue, or non-strict search of any filter value in list(,) of dataValue
- dataKey_strict - add [_strict] to dataKey in filter builder and in filtered html elements. All strict filter groups will be parsed as one same group and each value in DataValues list will be compared with each selected [strict] filter button.
- use for when DataValue is List(,) and/or data string contains multiple values and complete match with all filters is required.
- reset value of DataKey - creates a button that will un-select all filters buttons on page and return <selected by default filter values to selected state. DataValue need to be present but can be left empty.
Example[edit]
- Basic example using text inside the buttons.
{{#invoke:FilterBuilder|filterBuilder|color|red,blue,yellow|RED,BLUE,YELLOW|RED}}
- example for reset button
{{#invoke:FilterBuilder|filterBuilder|reset||Press to reset all filters}}
- Another example, but showing you add images instead of text.
{{#invoke:FilterBuilder|filterBuilder|color|red,blue,yellow|[[File:Fish.png|link=]],[[File:Fish.png|link=]],[[File:Fish.png|link=]]|blue,yellow}}
- Can even customize image (e.g. sizing, captions, etc.
{{#invoke:FilterBuilder|filterBuilder|color|red,blue,yellow|[[File:Fish.png|link=|20px|Red]],[[File:Fish.png|link=|20px|Blue]],[[File:Fish.png|link=|20px|Yellow]]}}