Git Product home page Git Product logo

Comments (6)

astridx avatar astridx commented on September 4, 2024

I would also like this option

from leaflet.control.layers.tree.

jjimenezshaw avatar jjimenezshaw commented on September 4, 2024

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.

astridx avatar astridx commented on September 4, 2024

Please check if my solution is ok.: #13

from leaflet.control.layers.tree.

jjimenezshaw avatar jjimenezshaw commented on September 4, 2024

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.

jjimenezshaw avatar jjimenezshaw commented on September 4, 2024

@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.

astridx avatar astridx commented on September 4, 2024

Thank you very much @jjimenezshaw

from leaflet.control.layers.tree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.