Small improvments in sorting.

This commit is contained in:
Lars Jung 2012-10-28 02:55:57 +02:00
parent a447502703
commit 3a92606e0c
4 changed files with 17 additions and 19 deletions

View file

@ -65,7 +65,14 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
$all.removeClass('ascending').removeClass('descending');
order.head.addClass(order.clas);
$('#items .item').detach().sort(order.fn).appendTo('#items');
var current = $('#items .item');
var sorted = $('#items .item').sort(order.fn);
for (var i = 0, l = current.length; i < l; i += 1) {
if (current[i] !== sorted[i]) {
sorted.detach().sort(order.fn).appendTo('#items');
break;
}
}
},
onContentChanged = function (item) {