Comments (6)
If you just want to use the Control.Layers.Tree, start it with the option collapsed: false
.
Something like L.control.layers.tree(baseTree, null, {collapsed: false}).addTo(map);
If you want to create your own Control, you have to extend the the options with the default value.
from leaflet.control.layers.tree.
Thanks for your answer Javier. Sadly, the code does not works as it supposed to do it. I've typed it as you say, but have had no effect at all. I've also modified the .js file a little bit adding "collapsed: false" to the options statement but none of this make any change... Thanks anyway!
Regards, M.
from leaflet.control.layers.tree.
I did in this fiddle, and it works (a copy of basic.html, just adding this option)
https://jsfiddle.net/fkd7ecc9/
Could you show us an example?
from leaflet.control.layers.tree.
Hi Javier! Thanks for your answer, and my apologies for my late on this one...
So, here is the thing:
Following your example, I've created a piece of my webpage in jsfiddle, using the leaflet libraries I'm trying to merge (lealfet, layers tree and sidebar v2, among others...). It was a nice exercise although a bit frustrating, specially when I realized jsfiddle didn't saved my work automatically and I losted four hours in a row coding! Part of the learning curve I guess... anyway I have to admit that jsfiddle is a nice piece of software!
Ok, so, once I had all working in jsfiddle I tried to made the same with my original code, and had found it wasnt working (layers tree appears inside sidebar pane but collapsed... no mater how many "collapsed: false" declarations I had included in my code!...). To make a long story short; after chopping out pieces of code I found that layers tree and David Chouse´s navbar (https://github.com/davidchouse/Leaflet.NavBar) used the same "options" variable declaration (I cant include NavBar in my example, cause I cant found a working library for jsfiddle, only github, sorry...).
So, the solution I've found was to rename one of the "options" declaration to "options2" (clever right ;)) and voila! Now I have an expanded layers tree inside sidebar. My next step is to turn off the surrounding box around layers tree, or at least make it invisible, but I cant found the correct CSS definition. I´ll see how I can accomplish this...
Here is my jsfiddle example... https://jsfiddle.net/mbotti/z3f4x0w7/
Regards, M.
from leaflet.control.layers.tree.
Great that you get it.
Using the Chrome "Developer Tools" you get easily to this CSS definition (line 449 of css file):
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
border: 2px solid rgba(0,0,0,0.2);
background-clip: padding-box;
}
I understand that I can close the issue.
from leaflet.control.layers.tree.
Thanks again Javier for your kindly help! You can close this issue.
Regards, M.
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.