Skip to content

Add sortLayers and sortFunction options to sort layers#43

Open
grischard wants to merge 1 commit intoismyrnow:gh-pagesfrom
grischard:sortLayers-PR
Open

Add sortLayers and sortFunction options to sort layers#43
grischard wants to merge 1 commit intoismyrnow:gh-pagesfrom
grischard:sortLayers-PR

Conversation

@grischard
Copy link
Copy Markdown

This is basically a backport of Leaflet/Leaflet#4711 that is included in Leaflet 1.0.2.

It keeps original order by default. If sortLayers is true, it sorts alphabetically if no compare function is specified. If sortFunction is defined, it uses the compare function to sort the layers .

@NHellFire
Copy link
Copy Markdown

Can you drop .layer from the sort function arguments or add groupA and groupB? So that group names can also be used.

@grischard
Copy link
Copy Markdown
Author

I see how that would be useful, yes. But then I also like to keep backwards compatibility with Leaflet itself. Maybe something can be done with a variable number of arguments.

Would you have a suggestion on how we should call the sortLayers option?

@ismyrnow is there any chance this could ever get merged?

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

Successfully merging this pull request may close these issues.

2 participants