leaflet-groupedlayercontrol
leaflet-groupedlayercontrol copied to clipboard
Add sortLayers and sortFunction options to sort layers
This is basically a backport of https://github.com/Leaflet/Leaflet/pull/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 .
Can you drop .layer from the sort function arguments or add groupA and groupB? So that group names can also be used.
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?