Comments (6)
I would also like this option
from leaflet.control.layers.tree.
Thanks @MappingSteve for you suggestion.
As you are realizing, it has not a simple solution. I have been thinking about that, and:
- Detecting if child layers are activated/deactivated out of the tree (you can do it in your javascript due to whatever other reason) is not that easy and entangles the code.
- There are many opinions on how the control (checkbox) should look like. And where should be placed.
- There are opinions on how the control should behave (the tree states you mention, for instance).
I am thinking on adding a callback that lets you manage it and easily change your state (checkbox of your choice) and activate or deactivate layers. It is not going to be just a boolean in the options... you will have to code a bit (don't worry, I'll add an example)
I will link "soon" a PR here.
PS: GitHub does not notify me when you edit your comment.
from leaflet.control.layers.tree.
Please check if my solution is ok.: #13
from leaflet.control.layers.tree.
Thanks @astridx . Unfortunately your PR #13 was too slow in the example you added (it does recreate the full tree for every single node). I looked for a faster solution in this PR: #14
It also lets you add it on any node(s) you want, and use the HTML you prefer.
Still needs documentation and tests. You can start having a look to the tests.
from leaflet.control.layers.tree.
@MappingSteve @astridx
I founded a better solution. Now you just have to add the option selectAllCheckbox: true
to the nodes where you want that feature (probably on all with children
). Look at the examples.
I have already merged #14 into master. I will make a release soon.
from leaflet.control.layers.tree.
Thank you very much @jjimenezshaw
from leaflet.control.layers.tree.
Related Issues (20)
- Layer ordering issue ? HOT 3
- Getting layer states and switching layer states by js HOT 1
- flashing bug
- Show intersection of overlays HOT 2
- Working with markercluster HOT 1
- Label Reference of Overlays for overlayadd and overlayremove to implement legend control HOT 5
- Option to load all children as selected on load by default
- Issues with collapse and addLayer
- only one layer with no children's
- potential bug in selectAllCheckbox
- How to change the title (hint text) of toggle button? HOT 2
- How to reference DOM label selector in tree [upon selection] HOT 2
- Referencing text Labels of children selected in "SelectAllCheckbox"
- eventedClasses HOT 1
- Prevent adding layer while expanding Layer-Control on mobile HOT 5
- Update dinamically the menu HOT 1
- How to add Layer on non Leaf node HOT 5
- markers with checkboxes in the basemap HOT 1
- 4 control panel shows when the layer is added to the map HOT 2
- panel visibility toggle on click HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet.control.layers.tree.