Skip to content

TagFilterButton is not a Layer #1671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions folium/plugins/tag_filter_button.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from branca.element import MacroElement
from jinja2 import Template

from folium.elements import JSCSSMixin
from folium.map import Layer
from folium.utilities import parse_options


class TagFilterButton(JSCSSMixin, Layer):
class TagFilterButton(JSCSSMixin, MacroElement):
"""
Creates a Tag Filter Button to filter markers based on criteria
(https://github.com/maydemirx/leaflet-tag-filter-button)
Expand All @@ -14,8 +14,6 @@ class TagFilterButton(JSCSSMixin, Layer):
----------
data: list, of strings.
The tags to filter for this filter button.
name: string, default None
The name of the Layer, as it will appear in LayerControls.
icon: string, default 'fa-filter'
The icon for the filter button
clear_text: string, default 'clear'
Expand All @@ -24,12 +22,6 @@ class TagFilterButton(JSCSSMixin, Layer):
if True, the plugin will filter on every click event on checkbox.
open_popup_on_hover: bool, default False
if True, popup that contains tags will be open at mouse hover time
overlay : bool, default True
Adds the layer as an optional overlay (True) or the base layer (False).
control : bool, default True
Whether the Layer will be included in LayerControls.
show: bool, default True
Whether the layer will be shown on opening (only for overlays).

"""

Expand Down Expand Up @@ -71,17 +63,13 @@ class TagFilterButton(JSCSSMixin, Layer):
def __init__(
self,
data,
name=None,
icon="fa-filter",
clear_text="clear",
filter_on_every_click=True,
open_popup_on_hover=False,
overlay=True,
control=True,
show=True,
**kwargs
):
super().__init__(name=name, overlay=overlay, control=control, show=show)
super().__init__()
self._name = "TagFilterButton"
self.options = parse_options(
data=data,
Expand Down