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

Remove then re-add a base layer prevents the overlay groups from displaying in group layer control #6

Closed
ChrisCSmith opened this issue Feb 6, 2014 · 3 comments

Comments

@ChrisCSmith
Copy link

When calling removeLayer() to remove a base layer (last one displayed in group layer control) and then calling addBaseLayer() to readd the layer; the grouplayer control only displays base layers and cannot display the group layer options.

It appears that html controls are being appended/added again/duplicated in the _domGroups[0].innerHTML

Updating the following two functions appears to fix this:

addBaseLayer: function (layer, name) {
this._addLayer(layer, name);
/Start inserted code/
this._domGroups.length = 0;
/End inserted code/
this._update();
return this;
},

addOverlay: function (layer, name, group) {
this._addLayer(layer, name, group, true);
/Start inserted code/
this._domGroups.length = 0;
/End inserted code/
this._update();
return this;
},

@ismyrnow
Copy link
Owner

A similar bug was recently reported and their pull request should have fixed this issue as well. Try the latest code out and let me know if it solves your issue.

@ChrisCSmith
Copy link
Author

if the fix was the recent change submitted by blomm then that isnt the fix for the issue I have raised above (blomm and I are working on the same project)

@blomm
Copy link
Contributor

blomm commented Feb 12, 2014

I can confirm that these two lines of code are necessary if you are adding/removing layers to the layer control after the layer control has initially been built. The two lines of code are made necessary because of the unique way the overlay container is built taking groups into consideration

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

3 participants