leaflet-groupedlayercontrol icon indicating copy to clipboard operation
leaflet-groupedlayercontrol copied to clipboard

Add sortLayers and sortFunction options to sort layers

Open grischard opened this issue 9 years ago • 2 comments

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 .

grischard avatar Nov 24 '16 19:11 grischard

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

NHellFire avatar Feb 14 '18 10:02 NHellFire

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?

grischard avatar Feb 16 '18 16:02 grischard