From 173059f6d00faa06dab9188efb2d7536f15861e4 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 18 Feb 2014 12:29:05 +0100 Subject: Fixed file list sorting Now using a natural sort algorithm that is more consistent between JS and PHP (although not perfect in some corner cases) - added OC.Util.naturalSortComparator that uses the same algo that was used for the user list - changed user list and files list to use OC.Util.naturalSortComparator - removed toLowerCase() and changed the comparator to use String.localeCompare() - added unit tests - added OC_NaturalSort that is used by OCP\Util::naturalSortCompare() --- settings/js/users/users.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'settings/js/users') diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 883851e2a2f..a94352e8e18 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -189,13 +189,15 @@ var UserList = { var rows = $userListBody.find('tr').get(); rows.sort(function(a, b) { + // FIXME: inefficient way of getting the names, + // better use a data attribute a = $(a).find('td.name').text(); b = $(b).find('td.name').text(); var firstSort = UserList.preSortSearchString(a, b); if(typeof firstSort !== 'undefined') { return firstSort; } - return UserList.alphanum(a, b); + return OC.Util.naturalSortCompare(a, b); }); var items = []; -- cgit v1.2.3