diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 8bc487264..21293f08e 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -2420,6 +2420,14 @@ angular.module('syncthing.core') debugLevel: 2, source: buildTree($scope.restoreVersions.versions), renderColumns: function (event, data) { + // Case insensitive sort with folders on top. + var cmp = function(a, b) { + var x = (a.isFolder() ? "0" : "1") + a.title.toLowerCase(), + y = (b.isFolder() ? "0" : "1") + b.title.toLowerCase(); + return x === y ? 0 : x > y ? 1 : -1; + }; + data.tree.getRootNode().sortChildren(cmp, true); + var node = data.node, $tdList = $(node.tr).find(">td"), template;