Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show/hide list markers on filtering with Layer Groups #11

Open
bmydland opened this issue May 3, 2022 · 0 comments
Open

Show/hide list markers on filtering with Layer Groups #11

bmydland opened this issue May 3, 2022 · 0 comments

Comments

@bmydland
Copy link

bmydland commented May 3, 2022

Im using the native Leaflet filtering (Layer Groups and Layers Control): https://leafletjs.com/examples/layers-control/
When I hide/show the different groups, the marker list it's not updating. How can I achieve this?
I've also tried this with the demo-project for this plugin - same results as in my project.

I've made a function that checks if each filter is checked of that helps:
let checkboxTest = document.querySelectorAll('.leaflet-control-layers-selector'); for(let i = 0; i < checkboxTest.length; i++) { checkboxTest[i].addEventListener('change', function(){ console.log(checkboxTest[i].parentElement.textContent + ' is: ' + checkboxTest[i].checked); }); }

Here is my Layer control:
`
const overLayMap = {
'Group A': groupA,
'Group B': groupB,
};

  const filter = L.control.layers(null, overLayMap, {collapsed:false}).addTo(map);

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant