jjimenezshaw / Leaflet.Control.Layers.Tree

a Tree Layers Control for Leaflet
https://jjimenezshaw.github.io/Leaflet.Control.Layers.Tree/examples/basic.html
BSD 3-Clause "New" or "Revised" License
148 stars 36 forks source link

Add possibility to collapse specific nodes #9

Closed ybasket closed 4 years ago

ybasket commented 5 years ago

For large trees (esp. deeply nested ones), it might not be desired to have them all expanded or collapsed initially, but only some parts. This PR adds the possibility to set a collapsed flag on each tree node so that this can be controlled more fine-grained, for example by expanding only path based on user selection or only the first n levels, leaving the rest collapsed.

jjimenezshaw commented 5 years ago

Sounds good. Could you add some tests? Have a look at the section Expand and collapse.

BTW, what I do to expand only the selected one is collapseTree(...).expandSelected(...).

jjimenezshaw commented 5 years ago

Did you see the tests that are already there? They can be useful. Just take one as a reference from Expand and collapse.

jjimenezshaw commented 4 years ago

hi @ybasket I have done some tests for your PR, but I cannot commit/push in your branch. Could you give me permission? Thanks

ybasket commented 4 years ago

Hey @jjimenezshaw, you should now have push permission. Sorry for not getting back on this PR, I completely forgot about it…