Skip to content
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

Nested groups, ungrouped layers #52

Open
tomchadwin opened this issue May 20, 2017 · 1 comment
Open

Nested groups, ungrouped layers #52

tomchadwin opened this issue May 20, 2017 · 1 comment

Comments

@tomchadwin
Copy link

Apologies for the basic questions. Does this support:

  1. Groups within groups?
  2. Layers not in groups?
@Azmisov
Copy link

Azmisov commented Dec 21, 2017

It doesn't support nested (tree-style) groups.

However, I was able to do "layers not in groups" or ungrouped layers by doing the following:

  • set the group name to be empty string
  • add the following CSS .leaflet-control-layers-group-name:empty{display:none;}

Technically, they are still grouped, but it hides the group name from the control, so it appears as though the contained layers are ungrouped. This will only work if you do not add styling to the group name wrapper (the label element). It also works with the groupCheckboxes option set to true. The plugin doesn't include the checkbox when the group name is empty, which is nice.

What do you guys think about adding a new advanced option classNames, which accepts an object of the form: { groupname: classname, ...}. Then you could add custom CSS classes to each group, and do less hacky per-group styling? For instance, you could add {"hidden_group1": "hidden"} to hide the header and style the contained layer controls to look like top-level on-off controls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants