Sub catagories in leaflet layercontrol

المشرف العام

Administrator
طاقم الإدارة
I am trying to create subcategory in layers which looks like below and trying to display the Banks on basis of their names.

I created a new control

customLayerSwitcher = L.control({ position: 'topright' });

And in the control I used a plugin Checkboxtree to create the checkboxes.

Finally the display of the banks is controlled on click event of the checkboxes.

$("#all-banks").change(function(){ if (this.checked){ banks.addTo(map) console.log("data displayed"); } else{ map.removeLayer(banks); } });

The data loads, but the map hangs and the customLayerswitcher comes in display and goes out. The solution can be seen here

Is there any better solution or existing plugins to create the subcategories? What are the things i am missing?



أكثر...
 
أعلى